[Android] Display proguard stack tace source location


Writing time : 2017-03-18 15:32:40

Display proguard stack tace source location

The advantage of using proguard is that the source is obfuscated, but when an exception occurs, it is displayed as an unkown source and the source location is not known.

Caused by: java.lang.IllegalArgumentException:  
Comparison method violates its general contract!  
at java.util.TimSort.mergeLo(TimSort.java:761)  
at java.util.TimSort.mergeAt(TimSort.java:497)  
at java.util.TimSort.mergeCollapse(TimSort.java:424)  
at java.util.TimSort.sort(TimSort.java:210)  
at java.util.Arrays.sort(Arrays.java:1998)  
at java.util.Collections.sort(Collections.java:1900)  
at kr.co.appmania.myapp.b.a.a(Unknown Source)  

To check the source location in the stack trace, add the following option to the proguard-project.txt file.

-keepattributes SourceFile,LineNumberTable  

Now you can check the source file and line number in the stack trace.

Caused by: java.lang.IllegalArgumentException:  
Comparison method violates its general contract!  
at java.util.TimSort.mergeLo(TimSort.java:761)  
at java.util.TimSort.mergeAt(TimSort.java:497)  
at java.util.TimSort.mergeCollapse(TimSort.java:424)  
at java.util.TimSort.sort(TimSort.java:210)  
at java.util.Arrays.sort(Arrays.java:1998)  
at java.util.Collections.sort(Collections.java:1900)  
at kr.co.appmania.myapp.b.a.a(AppModelSortUtility.java:35)  

Reference URL


https://www.guardsquare.com/en/proguard/manual/examples#stacktrace

Previous post