我刚启用了Proguard
并使用Android > Export Android application
导出了该应用。
当我直接在Eclipse中运行我的应用程序时,它运行良好,如果我禁用ProGuard
并导出应用程序,它也可以。但是当我使用Proguard
导出它时,它会在我的手机上显示一个弹出窗口Unfortunately the Application has Stopped
所以问题肯定在于Proguard
。
这是LogCat错误:
08-01 03:58:02.472: E/AndroidRuntime(13173): FATAL EXCEPTION: main
08-01 03:58:02.472: E/AndroidRuntime(13173): Process: com.filmalb.app, PID: 13173
08-01 03:58:02.472: E/AndroidRuntime(13173): java.lang.ExceptionInInitializerError
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.actionbarsherlock.app.SherlockFragmentActivity.getSherlock(ProGuard:31)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(ProGuard:266)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity.setContentView(ProGuard:75)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity.setContentView(ProGuard:67)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity.setContentView(ProGuard:59)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.filmalb.app.MainActivity.onCreate(ProGuard:101)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.app.Activity.performCreate(Activity.java:5389)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2246)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2340)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.app.ActivityThread.access$800(ActivityThread.java:157)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.os.Handler.dispatchMessage(Handler.java:102)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.os.Looper.loop(Looper.java:157)
08-01 03:58:02.472: E/AndroidRuntime(13173): at android.app.ActivityThread.main(ActivityThread.java:5293)
08-01 03:58:02.472: E/AndroidRuntime(13173): at java.lang.reflect.Method.invokeNative(Native Method)
08-01 03:58:02.472: E/AndroidRuntime(13173): at java.lang.reflect.Method.invoke(Method.java:515)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
08-01 03:58:02.472: E/AndroidRuntime(13173): at dalvik.system.NativeStart.main(Native Method)
08-01 03:58:02.472: E/AndroidRuntime(13173): Caused by: java.lang.IllegalArgumentException: Class ActionBarSherlockCompat is not annotated with @Implementation
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.actionbarsherlock.ActionBarSherlock.registerImplementation(ProGuard:124)
08-01 03:58:02.472: E/AndroidRuntime(13173): at com.actionbarsherlock.ActionBarSherlock.<clinit>(ProGuard:52)
这里是proguard.cfg
-printmapping proguard.map
-renamesourcefileattribute ProGuard
-keepattributes SourceFile,LineNumberTable
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep class android.support.v4.** { *; }
-dontwarn android.support.v4.**
-dontwarn javax.activation.**
-dontwarn javax.security.**
-dontwarn java.awt.**
-dontwarn com.squareup.**
-libraryjars <java.home>/lib/rt.jar
-keep class javax.** {*;}
-keep class com.sun.** {*;}
-keep class myjava.** {*;}
-keep class org.apache.harmony.** {*;}
-keep public class Mail {*;}
-dontshrink
-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 com.android.vending.licensing.ILicensingService
-keep public class * extends com.actionbarsherlock.app.SherlockFragmentActivity{*;}
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock {
<init>(android.app.Activity, int);
}