2012-04-15 83 views
33

有没有办法让ProGuard返回崩溃发生的行号? 我可以使用retrace来找到该方法,但通常对于像NullPointerException这样的事物来说,存在太多的可能性,并且在大量的代码中,它极难确定潜在的原因,因为您必须检查每个对象以及它的生命周期当然没有错。如果ProGuard可以将此缩小到我的行号,这将非常有帮助。Android ProGuard返回行号

回答

65

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

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

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

+11

如果使用模糊处理,这带回原来的名称。 从其他的答案,像这样的工作: -renamesourcefileattribute的SourceFile -keepattributes的SourceFile,LineNumberTable – 2014-03-22 15:48:17

+1

使用#代替//评论中的ProGuard文件中的行。 – 2017-07-03 09:31:40

+0

我无法在Android Studio解决方案的任何位置找到proguard-project.txt文件。它在哪里? – 2018-02-14 18:05:49