使用带有proguard的actionbarsherlock的IllegalArgumentException

时间:2012-11-28 11:17:43

标签: java actionbarsherlock proguard

我的项目在没有Proguard的情况下工作正常,即在我运行项目时安装Eclipse生成的apk并将其安装在Samsung Galaxy设备上,一切都很好。但是当我尝试使用Proguard导出已签名的apk时,导出它很好,但是当我尝试运行应用程序时不起作用。我在模拟器上安装了apk以查看Logcat的异常,它返回我是这样的:

11-28 02:28:33.709: E/AndroidRuntime(853): FATAL EXCEPTION: main
11-28 02:28:33.709: E/AndroidRuntime(853): java.lang.ExceptionInInitializerError
11-28 02:28:33.709: E/AndroidRuntime(853):  at    com.actionbarsherlock.app.SherlockActivity.c(Unknown Source)
11-28 02:28:33.709: E/AndroidRuntime(853):  at com.actionbarsherlock.app.SherlockActivity.setContentView(Unknown Source)
11-28 02:28:33.709: E/AndroidRuntime(853):  at com.linxter.allaware.views.AllAwareActivity.a(Unknown Source)
11-28 02:28:33.709: E/AndroidRuntime(853):  at   com.linxter.allaware.views.StartupActivity.onCreate(Unknown Source)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.app.Activity.performCreate(Activity.java:4465)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.os.Looper.loop(Looper.java:137)
11-28 02:28:33.709: E/AndroidRuntime(853):  at android.app.ActivityThread.main(ActivityThread.java:4424)
11-28 02:28:33.709: E/AndroidRuntime(853):  at java.lang.reflect.Method.invokeNative(Native Method)
11-28 02:28:33.709: E/AndroidRuntime(853):  at java.lang.reflect.Method.invoke(Method.java:511)
11-28 02:28:33.709: E/AndroidRuntime(853):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-28 02:28:33.709: E/AndroidRuntime(853):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-28 02:28:33.709: E/AndroidRuntime(853):  at dalvik.system.NativeStart.main(Native Method)
11-28 02:28:33.709: E/AndroidRuntime(853): Caused by: java.lang.IllegalArgumentException: Class a is not annotated with @Implementation
11-28 02:28:33.709: E/AndroidRuntime(853):  at com.actionbarsherlock.a.a(Unknown Source)
11-28 02:28:33.709: E/AndroidRuntime(853):  at com.actionbarsherlock.a.<clinit>(Unknown Source)
11-28 02:28:33.709: E/AndroidRuntime(853):  ... 18 more

我使用的是最新版本的Proguard,版本4.8和最新版本的ActionBarSherlock,4.2.0。这是我的Proguard配置文件的一部分:

-ignorewarnings
-target 1.6
-optimizationpasses 5
-printmapping mapping.txt
# -overloadaggressively
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt

# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

# Recommended configuration for ActionBarSherlock on http://actionbarsherlock.com/faq.html
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
-keepattributes *Annotation*

# Keep classes which are entry points.
-keep public class * extends android.app.Activity
-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.Application


-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum  * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,allowshrinking class * {
    native <methods>;
}

有什么问题?我感谢任何帮助。谢谢。

0 个答案:

没有答案