【发布时间】:2017-03-22 07:22:07
【问题描述】:
我有相同的代码:
public static void clearCacheWithoutMainActivity()
{
try
{
viewModelForClass.entrySet().removeIf(e -> !e.getKey().equals(className));
}
catch(NoClassDefFoundError e)
{
int k = 0;
}
}
private static Map<String, Pair<BaseObservable, Date>> viewModelForClass = new LinkedHashMap<>();
private static final String className = MainActivity.class.getName();
在模拟器 android 中我没有捕捉到错误 NoClassDefFoundError。但是在我的设备中,这个 android 5.1 我发现了这个错误。
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "ca.amikash.cashback"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
jumboMode = false
maxProcessCount 4
javaMaxHeapSize "6g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
我的 build.gradle 文件。这可能是错的?
【问题讨论】:
标签: java android devise try-catch