我在发布模式下使用 proguard 混淆测试我的应用程序时收到以下错误:
08-09 21:44:06.140: E/AndroidRuntime(4465): FATAL EXCEPTION: main
08-09 21:44:06.140: E/AndroidRuntime(4465): java.lang.ExceptionInInitializerError
08-09 21:44:06.140: E/AndroidRuntime(4465): at java.lang.Class.newInstanceImpl(Native Method)
08-09 21:44:06.140: E/AndroidRuntime(4465): at java.lang.Class.newInstance(Class.java:1409)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.app.Instrumentation.newApplication(Instrumentation.java:957)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.app.Instrumentation.newApplication(Instrumentation.java:942)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.app.LoadedApk.makeApplication(LoadedApk.java:461)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3264)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.app.ActivityThread.access$2200(ActivityThread.java:117)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.os.Looper.loop(Looper.java:123)
08-09 21:44:06.140: E/AndroidRuntime(4465): at android.app.ActivityThread.main(ActivityThread.java:3687)
08-09 21:44:06.140: E/AndroidRuntime(4465): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 21:44:06.140: E/AndroidRuntime(4465): at java.lang.reflect.Method.invoke(Method.java:507)
08-09 21:44:06.140: E/AndroidRuntime(4465): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
08-09 21:44:06.140: E/AndroidRuntime(4465): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
08-09 21:44:06.140: E/AndroidRuntime(4465): at dalvik.system.NativeStart.main(Native Method)
08-09 21:44:06.140: E/AndroidRuntime(4465): Caused by: java.lang.RuntimeException: SystemServiceCreator must be implement SystemService
08-09 21:44:06.140: E/AndroidRuntime(4465): at org.holoeverywhere.SystemServiceManager.register(Unknown Source)
08-09 21:44:06.140: E/AndroidRuntime(4465): at org.holoeverywhere.app.Application.<clinit>(Unknown Source)
08-09 21:44:06.140: E/AndroidRuntime(4465): ... 16 more
我的 proguard.txt 文件:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepattributes Signature
-keep class sun.misc.Unsafe { *; }
-keep class org.springframework.** { *; }
-keep class org.codehaus.jackson.** { *; }
-keep class org.holoeverywhere.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep class com.facebook.** { *; }
-dontwarn org.springframework.**
-dontwarn org.apache.**
-libraryjars libs/commons-collections-3.2.1.jar
-libraryjars libs/congregando-message-1.0.0-SNAPSHOT.jar
-libraryjars libs/gson-2.2.3.jar
-libraryjars libs/spring-android-auth-1.0.1.RELEASE.jar
-libraryjars libs/spring-android-core-1.0.1.RELEASE.jar
-libraryjars libs/spring-android-rest-template-1.0.1.RELEASE.jar
如果我禁用混淆,应用程序运行正常。你能告诉我发生了什么事吗?