The question is published on by Tutorial Guruji team.
Before Proguard with:
After Proguard I got:
Which is obviously wrong.
Here is the tested rules to solve this problem :
-keep class java.lang.StackElement -keepattributes StackTraceElement -keepattributes SourceFile,LineNumberTable -keepattributes Signature -keepattributes InnerClasses,EnclosingMethod -keepattributes getStackTrace
But it doesn’t work. Is there any specific rules to let this piece of code work properly ?
According to the manual, you need to do this:
-renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable
and you need to use
-printmapping to save the mappings so that you can then decode the obfuscated stacktraces.
I should point out that references to classes and methods in the standard class library will always be retained since they are needed when your code is loaded. Therefore this “-keep” is superfluous:
-keep class java.lang.StackElement
And you are also telling Proguard to keep attributes called “StackTraceElement” and “getStackTrace” which don’t exist. The list of supported attributes is documented here
- Proguard doesnt preserve the line numbers and method names in stacktrace. The question is different (you don’t want to preserve method names!) but the accepted answer mentions the solution above.