How to debug with confusing (with ProGuard) applications on Android?

When I got something like this

ERROR/AndroidRuntime(18677): Caused by: java.lang.NullPointerException ERROR/AndroidRuntime(18677): at com.companyname.aaa(Unknown Source) 

How can I find out where the problem is and debug this problem? I only got the result display from ProGuard and don’t know the line number. Thank.

+65
android debugging obfuscation proguard
Oct 12 2018-10-12
source share
3 answers

Add the following lines to the proguard configuration.

 -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable 

Now your stack traces will contain line numbers, and with the retrace tool that comes with the proguard (included in the Android SDK), you can debug as usual.

Please note that even if you have not used these two configuration parameters, retrace can still display useful information if you have a mapping file, although not entirely unambiguously.

Note. The mapping file is created using the proguard configuration option:

  -printmapping outputfile.txt 

In the ant file that comes with the Android SDK, it is installed on map.txt.

Good luck.

+108
Jul 12 '11 at 19:50
source share

To use any stack traces from your Android Market account, you can use the map file created using the -printmapping option in the ProGuard configuration using the ReTrace tool (ProGuard companion) to decode the stack trace. You can also decode manually using the contents of the map file, but this is tedious.

The examples in the ProGuard Guide include a section on creating useful obfuscation stack traces, including how to save line numbers.

Unfortunately, if you did not install ProGuard to save line numbers, you can only identify the method that throws the exception.

+15
Oct 13 '10 at 9:03
source share

Paste the stack trace into the stack_trace.txt file

Run the following command: java -jar retrace.jar classes-processed.map stack_trace.txt

retrace.jar is located in sdk \ tools \ proguard \ lib \ retrace.jar classes-processed.map is the output file created by proguard when you obfuscate

+4
Aug 05 '15 at 18:56
source share



All Articles