本文介绍了Android ProGuard 返回行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让 ProGuard 返回崩溃发生的行号?我可以使用 retrace 来访问该方法,但通常对于诸如 NullPointerException 之类的事情有太多的可能性,并且在一大段代码中很难确定根本原因因为您必须检查每个对象及其生命周期,以确保没有任何问题.如果 ProGuard 可以将其缩小到行号,那真的很有帮助.

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.

推荐答案

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

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/手册/使用

这篇关于Android ProGuard 返回行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 05:37
查看更多