dexguard混淆问题

时间:2015-04-09 07:44:57

标签: android proguard dexguard

我正在使用dexguard来混淆我的应用程序,但是当我这样做时,我在运行应用程序时遇到了崩溃。下面是堆栈跟踪。

04-08 17:46:11.786: E/AndroidRuntime(7569): java.lang.RuntimeException: An error occured while executing doInBackground()
04-08 17:46:11.786: E/AndroidRuntime(7569):     at android.os.AsyncTask$3.done(AsyncTask.java:299)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.util.concurrent.FutureTask.run(FutureTask.java:239)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.lang.Thread.run(Thread.java:841)
04-08 17:46:11.786: E/AndroidRuntime(7569): Caused by: java.lang.NoSuchFieldError: ˈ
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.lang.Class.getDeclaredAnnotation(Native Method)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.lang.Class.getAnnotation(Class.java:243)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at o.hS.ˊ(:124)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at o.ȑ.ˊ(:113)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at o.ڋ.doInBackground(:42)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-08 17:46:11.786: E/AndroidRuntime(7569):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-08 17:46:11.786: E/AndroidRuntime(7569):     ... 4 more

这是我从ACRA lib init方法获得的,因为我们有getAnnotation方法。我使用了-keepattributes *Annotation*-keep class org.acra.ACRA {*;}

但没有运气......

有人有想法吗?

谢谢,
吉姆。

1 个答案:

答案 0 :(得分:2)

您可能不需要混淆ACRA代码,因为它不是秘密库。所以你可以这样做:

# Keep all the ACRA classes
-keep class org.acra.** { *; }

或者,如果您非常特别,可以尝试使用以下内容配置ACRA:https://github.com/ACRA/acra/wiki/Proguard,在配置文件中包含以下内容:

# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'.
# Note: if you are removing log messages elsewhere in this file then this isn't necessary
-keep class org.acra.ACRA {
    *;
}

# keep this around for some enums that ACRA needs
-keep class org.acra.ReportingInteractionMode {
    *;
}

-keepnames class org.acra.sender.HttpSender$** {
    *;
}

-keepnames class org.acra.ReportField {
    *;
}

# keep this otherwise it is removed by ProGuard
-keep public class org.acra.ErrorReporter
{
    public void addCustomData(java.lang.String,java.lang.String);
    public void putCustomData(java.lang.String,java.lang.String);
    public void removeCustomData(java.lang.String);
}

# keep this otherwise it is removed by ProGuard
-keep public class org.acra.ErrorReporter
{
    public void handleSilentException(java.lang.Throwable);
}