我建立了我的应用程序的发布apk。它在很多设备上都是完美的;但是在这个设备上(google nexus 5-4.4.4-api 19)有一个崩溃:
Fatal Exception: java.lang.NoClassDefFoundError: org.joda.time.format.ISODateTimeFormat$Constants
at org.joda.time.format.ISODateTimeFormat.dateTimeNoMillis(ISODateTimeFormat.java:789)
at com.azeoo.android.network.converter.DateTimeConverter.deserializeDateTime(DateTimeConverter.java:84)
at com.azeoo.android.network.converter.DateTimeConverter.deserialize(DateTimeConverter.java:70)
at com.azeoo.android.network.converter.DateTimeConverter.deserialize(DateTimeConverter.java:24)
...
Gradle文件中正确添加了此库:
compile 'joda-time:joda-time:2.9.2'
我的proguard文件:
# Specific for https://github.com/PhilJay/MPAndroidChart
-keep class com.github.mikephil.charting.** { *; }
# Specific for https://github.com/bumptech/glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
# Esperandro
# Specific for http://dkunzler.github.io/esperandro/
-keepnames class de.devland.** { *; }
-keep class **$$Impl { public *;}
# keep the annotated things annotated
-keepattributes *Annotation*, EnclosingMethod, Signature, InnerClasses
# for dagger also preserve the interfaces
# assuming they reside in the sub-package 'preferences_main' and all end with 'Prefs'
#-keep class preferences_main.**Prefs { public *;}
# for gson see their documentation at
# https://code.google.com/p/google-gson/source/browse/trunk/examples/android-proguard-example/proguard.cfg
# Butterknife
# http://jakewharton.github.io/butterknife/
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
# Remove Android logging calls
# @see http://stackoverflow.com/questions/15571520/how-to-configure-proguard-to-only-remove-android-logging-calls
# This will not remove error log
-assumenosideeffects class com.azeoo.android.util.LogUtils {
public static void LOGD(...);
public static void LOGV(...);
public static void LOGI(...);
public static void LOGW(...);
public static void LOGE(...);
}
你们能帮我吗?
最佳答案
我认为这与multidex有关,正如你所说,它可以在其他设备上工作,但却在kitkat上苦苦挣扎。将以下内容添加到应用程序类:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}