如何调试与混淆(使用ProGuard)对Android应用程序? [英] How to debug with obfuscated (with ProGuard) applications on Android?

查看:174
本文介绍了如何调试与混淆(使用ProGuard)对Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我得到了这样的事情

ERROR/AndroidRuntime(18677): Caused by: java.lang.NullPointerException
ERROR/AndroidRuntime(18677):     at com.companyname.a.a.a(Unknown Source)

我怎么能知道问题的所在,并调试这个问题? 我只得到了ProGuard的输出映射,不知道的行号。 谢谢你。

How can I know where the problem is and debug this issue? I only got the mapping output from ProGuard and don't know the line number. Thanks.

推荐答案

以下行添加到您的ProGuard的配置。

Add the following lines to your proguard configuration.

-renamesourcefileattribute SourceFile    
-keepattributes SourceFile,LineNumberTable

现在你的堆栈跟踪将包括行号,并使用回扫工具附带的ProGuard(包含在Android SDK),您可以像调试正常。

Now your stack traces will include line numbers, and by using the retrace tool that ships with proguard (included in the Android SDK), you are able to debug like normal.

请注意,即使你没有使用这两个配置选项,追溯仍然可以提供输出有用的信息,你的映射文件,虽然没有完全明确。

Note that even if you didn't use these two configuration options, retrace still can output useful information provided you have the mappings file, albeit not totally unambiguously.

注:与映射文件被ProGuard的配置选项产生的:

Note: the file with the mappings is produced by the proguard configuration option:

 -printmapping outputfile.txt

在随Android SDK的Ant文件,它设置为mapping.txt。

In the ant file shipped with the Android SDK, it is set to mapping.txt.

祝你好运。

这篇关于如何调试与混淆(使用ProGuard)对Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆