Android ProGuard返回行号

Ali*_*Ali 36 java android proguard apk

有没有办法让ProGuard返回发生崩溃的行号?我可以retrace用来获取方法,但是经常因为NullPointerException有太多的可能性而且在大量的代码中很难确定根本原因,因为你必须检查每个对象和它的生命周期以确保没有任何东西错误.如果ProGuard可以将此范围缩小到我的行号,那将会非常有帮助.

den*_*eli 70

将此行添加到proguard-project.txt文件中.

# will keep line numbers and file name obfuscation
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
Run Code Online (Sandbox Code Playgroud)

http://proguard.sourceforge.net/index.html#manual/usage.html

  • 如果使用模糊处理,则会返回原始名称.从其他答案,这样的东西可以工作:-renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable (11认同)