java还原混淆代码_如何根据mapping.txt还原混淆的代码

本文介绍了如何使用ProGuard的mapping.txt文件来还原混淆后的Java代码堆栈跟踪。提供了通过GUI和命令行两种方式来解混淆堆栈跟踪的方法,帮助开发者更轻松地进行调试。
摘要由CSDN通过智能技术生成

BEFORE

Here’s the stack trace as obfuscated by ProGuard:

Caused by: java.lang.NullPointerException

at net.simplyadvanced.ltediscovery.be.u(Unknown Source)

at net.simplyadvanced.ltediscovery.at.v(Unknown Source)

at net.simplyadvanced.ltediscovery.at.d(Unknown Source)

at net.simplyadvanced.ltediscovery.av.onReceive(Unknown Source)

AFTER

All you need to do is write one line in the command prompt, and the obfuscation will be removed, as you can see here:

Caused by: java.lang.NullPointerException

at net.simplyadvanced.ltediscovery.UtilTelephony.boolean is800MhzNetwork()(Unknown Source)

at net.simplyadvanced.ltediscovery.ServiceDetectLte.void checkAndAlertUserIf800MhzConnected()(Unknown Source)

at net.simplyadvanced.ltediscovery.ServiceDetectLte.void startLocalBroadcastReceiver()(Unknown Source)

at net.simplyadvanced.ltediscovery.ServiceDetectLte$2.void onReceive(android.content.Context,android.content.Intent)(Unknown Source)

HOW TO DECODE STACK TRACE

You can choose either the command line method or GUI (Graphical User Interface) method.

HOW TO DECODE STACK TRACE VIA GUI

1) Open /tools/proguard/bin/proguardgui.bat

2) Select the “ReTrace” option on the left column.

3) Add your mapping file and obfuscated stack trace.

4) Click “ReTrace!”

Thanks to David Bilik for mentioning this GUI method.

HOW TO DECODE STACK TRACE VIA COMMAND LINE

1) You will need your ProGuard’s mapping.txt file and the stack trace (Ex: stacktrace.txt) that you want to de-obfuscate.

2) The easiest way to do the next step is copy both these files into your/tools/proguard/bin.

3) If you are on Windows, run the following command in the same directory as the files (make sure you change to your own file names):

retrace.bat -verbose mapping.txt stacktrace.txt > out.txt

4) out.txt will have the stack trace de-obfuscated. Now you can debug much easier and faster than before.

版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值