Jim
Jim

Reputation: 4719

dexguard obfuscation issue

I am using dexguard to obfuscate my app, but when i do this i am getting crash while running the application. Below is the stack trace.

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

This is i am getting from ACRA lib init method as we have getAnnotation method in it. I have used -keepattributes *Annotation* and -keep class org.acra.ACRA {*;}

but not any luck...

Does anyone have idea?

Thanks,
Jim.

Upvotes: 1

Views: 1336

Answers (1)

Jeevaraj Dhanaraj
Jeevaraj Dhanaraj

Reputation: 101

You may not require to obfuscate ACRA code as it is not a secret library. So you can do something like:

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

Or if you are very particular, you could try configuring ACRA using: https://github.com/ACRA/acra/wiki/Proguard by including the following in your config file:

# 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);
}    

Upvotes: 2

Related Questions