Java Android ProGuard返回线编号
有没有办法让ProGuard返回发生车祸的线路号?Java Android ProGuard返回线编号,java,android,apk,proguard,Java,Android,Apk,Proguard,有没有办法让ProGuard返回发生车祸的线路号? 我可以使用retrace来获得该方法,但是对于NullPointerException这样的事情,有太多的可能性,在一大块代码中很难确定根本原因,因为您必须检查每个对象及其生命周期,以确保没有任何错误。如果ProGuard能为我把这一行的范围缩小到一个行号,那将非常有帮助。将这一行添加到ProGuard-project.txt文件中 # will keep line numbers and file name obfuscation -rena
我可以使用
retrace
来获得该方法,但是对于NullPointerException
这样的事情,有太多的可能性,在一大块代码中很难确定根本原因,因为您必须检查每个对象及其生命周期,以确保没有任何错误。如果ProGuard能为我把这一行的范围缩小到一个行号,那将非常有帮助。将这一行添加到ProGuard-project.txt文件中
# will keep line numbers and file name obfuscation
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
创建新的Android项目时,它会告诉您可能要取消注释的行:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
所以,你应该考虑这些:
-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile
但是,请注意,出于某种原因,Firebase Crashlytics团队告诉我,这条线路可能会干扰他们的服务:
-renamesourcefileattribute SourceFile
因此,如果您使用它,您可能看不到崩溃堆栈跟踪的良好信息。我在Android Studio解决方案中的任何位置都找不到proguard-project.txt文件。它位于哪里???@MikeKeskinov,请参见
proguardFiles getDefaultProguardFile
,在那里您可以找到文件名。如果它不存在,创建一个。可能是proguard rules.pro
。我正想问这个问题,非常感谢你提供的信息。您知道如果我不使用这一行-renamesourcefileattribute SourceFile
,会导致问题吗?谢谢。@Hilal我决定不使用-重命名SourceFileAttribute源文件