Search code examples
javaandroidapkproguard

Android ProGuard return Line Number


Is there a way to get ProGuard to return a line number where the crash happened? I can use retrace to get to the method, but often for things like NullPointerException there are too many possibilities and in a large piece of code its extremely hard to determine the underlying cause as you have to check every object and it's life cycle to make sure nothing is wrong. It would really help if ProGuard could narrow this down to a line number for me.


Solution

  • Add this line to your proguard-project.txt file.

    # will keep line numbers and file name obfuscation
    -renamesourcefileattribute SourceFile
    -keepattributes SourceFile,LineNumberTable
    

    https://www.guardsquare.com/en/products/proguard/manual/usage