如何在 Eclipse 中调试 Proguard 混淆的 apk 文件

发布于 2024-12-04 07:58:05 字数 594 浏览 0 评论 0原文

使用 Proguard 并使用新密钥签名和导出后,我的应用程序崩溃了。
相同的代码可以在正常的 Eclipse 调试模式下工作。

我到处都读到了我应该使用mapping.txt来查找失败的代码。 但如何做到这一点,我已经用谷歌搜索了 2 个小时,但没有答案。

我现在使用 debug.keystore 签署 apk 文件并使用默认密码“android”。
有人说我应该在我的应用程序标签中 android:debuggable="false" 来制作 Proguard 在 Eclipse 中混淆了我的调试会话。

这是正确的吗?
任何帮助都会

Proguard Android 开发者页面上得到帮助,我找不到方法来做到这一点

“当混淆的代码输出堆栈跟踪时,方法名称会被混淆,这使得调试变得“

什么是“堆栈跟踪”以及来自哪里?

在页面 Proguard Manual 上我找不到解释

I got a crash in my app after using Proguard and signing and exporting with a new key.
The same code works in normal eclipse debug mode.

I read everywhere i should use the mapping.txt to find the code that failed.
But how to do that, I have google this for 2 hour now and no answer is working.

Im now signing the apk file with the debug.keystore and using the default password "android".
Someone say i should android:debuggable="false" in my application tag to make
Proguard obfuscate my debug session in eclipse.

Is this right?
Any help would be grate

on the Proguard Android Developer page I cannot find a way to do this

"When your obfuscated code outputs a stack trace, the method names are obfuscated, which makes debugging ha"

What "stack trace" and from where?

On the page Proguard Manual I cannot find an explanation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

走走停停 2024-12-11 07:58:05

您可以使用 Proguard GUI 最轻松地对堆栈跟踪进行反混淆。您可以通过 Android SDK 找到它。

sdk\tools\proguard\bin\proguardgui.bat
  1. 从上面的路径运行上面的 GUI。
  2. 单击左侧面板底部的“重新跟踪”按钮。
  3. 在“映射文件”文本框中添加映射文件 (mapping.txt) 的路径。
  4. 将堆栈跟踪的副本粘贴到“模糊堆栈跟踪”文本框中。
  5. 单击右下角的“重新跟踪”。
  6. 调试愉快!

在此处输入图像描述

You can de-obfuscate the stack trace most easily using the Proguard GUI. You'll find this with your Android SDK.

sdk\tools\proguard\bin\proguardgui.bat
  1. Run the GUI above from the path above.
  2. Click the 'ReTrace' button at the bottom of the panel on the left.
  3. Add the path to your Mapping File (mapping.txt) in the 'Mapping file' text box.
  4. Paste a copy of your stack trace in the 'Obfuscated stack trace' text box.
  5. Click 'ReTrace' in the bottom right.
  6. Happy Debugging!

enter image description here

醉酒的小男人 2024-12-11 07:58:05

不在 Eclipse 内。

在 Eclipse 之外,使用 ProGuard 中的 Retrace 函数。您还需要在项目的 proguard 目录下找到转储的堆栈跟踪和 mapping.txt 来反转混淆的堆栈跟踪。请记住在每次部署新版本的 Android 应用时保存 mapping.txt 的副本(最好在项目工作区之外)。

Not within Eclipse.

Outside of Eclipse, use Retrace function within ProGuard. You'll also need the dumped stacktrace and mapping.txt found under your project's proguard directory to reverse the obfuscated stacktrace. Remember to save a copy of mapping.txt (preferably outside of your project's workspace) each time you deploy a new version of your Android app.

单挑你×的.吻 2024-12-11 07:58:05

一直在研究这个,android开发者网站上的proguard文档演示了如何解码堆栈跟踪,但它没有指定如何获取堆栈跟踪。

http://developer.android.com/guide/developing/tools/proguard.html (请参阅“解码模糊堆栈跟踪”部分)

我尝试使用 logcat 转储,如下所示:-

E/AndroidRuntime(14584): FATAL EXCEPTION: main

E/AndroidRuntime(14584): java.lang.ExceptionInInitializerError

E/AndroidRuntime(14584):    at com.a.a.b.a.dg.<init>(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.q.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.y.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.y.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.aq.get(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.cp.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.ai.c(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.bg.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.a.o.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.ee.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.ag.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.cb.a(Unknown Source)

不幸的是,这不起作用,但如果我从每一行的开头删除 E/AndroidRuntime(14584) ,它就会起作用。做工作:

FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
    at com.a.a.b.a.dg.<init>(Unknown Source)
    at com.a.a.b.a.q.a(Unknown Source)
    at com.a.a.b.a.y.a(Unknown Source)
    at com.a.a.b.a.y.a(Unknown Source)
    at com.a.a.b.a.aq.get(Unknown Source)
    at com.a.a.b.cp.a(Unknown Source)
    at com.a.a.b.ai.c(Unknown Source)
    at com.a.a.b.bg.a(Unknown Source)
    at com.a.a.a.o.a(Unknown Source)
    at com.a.a.b.ee.a(Unknown Source)
    at com.a.a.b.ag.a(Unknown Source)
    at com.a.a.b.cb.a(Unknown Source)

因此,正如文档所述,您需要一个堆栈跟踪文件,并且似乎没有迹象表明可以从设备获取有效的堆栈跟踪文件。

我看到完成此操作的唯一方法是提供自定义异常处理程序并将堆栈跟踪写入 SD 卡。

Been looking into this, the documentation for proguard on the android developer site demonstrates how to decode a stack trace, but it does not specify how to get the stack trace.

http://developer.android.com/guide/developing/tools/proguard.html (see section Decoding Obfuscated Stack Traces)

I tried to use a logcat dump as follows:-

E/AndroidRuntime(14584): FATAL EXCEPTION: main

E/AndroidRuntime(14584): java.lang.ExceptionInInitializerError

E/AndroidRuntime(14584):    at com.a.a.b.a.dg.<init>(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.q.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.y.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.y.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.a.aq.get(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.cp.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.ai.c(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.bg.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.a.o.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.ee.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.ag.a(Unknown Source)

E/AndroidRuntime(14584):    at com.a.a.b.cb.a(Unknown Source)

Unfortunately this does not work, but it does work if I remove the E/AndroidRuntime(14584) from the beginning of each line it does work:

FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
    at com.a.a.b.a.dg.<init>(Unknown Source)
    at com.a.a.b.a.q.a(Unknown Source)
    at com.a.a.b.a.y.a(Unknown Source)
    at com.a.a.b.a.y.a(Unknown Source)
    at com.a.a.b.a.aq.get(Unknown Source)
    at com.a.a.b.cp.a(Unknown Source)
    at com.a.a.b.ai.c(Unknown Source)
    at com.a.a.b.bg.a(Unknown Source)
    at com.a.a.a.o.a(Unknown Source)
    at com.a.a.b.ee.a(Unknown Source)
    at com.a.a.b.ag.a(Unknown Source)
    at com.a.a.b.cb.a(Unknown Source)

So as the documentation states you need a stack trace file, and there appears to be no indication of getting a valid stack trace file from the device.

The only way I have seen this done is by providing a custom exception handler and writing the stack trace to the sdcard.

小帐篷 2024-12-11 07:58:05

对于 Mac 用户,请使用以下代码来运行
/Users/XYZ/Library/Android/sdk/tools/proguard/bin/proguardgui.sh

  1. 从上面的路径运行上面的 GUI。
  2. 单击左侧面板底部的“重新跟踪”按钮。
  3. 在“映射”中添加映射文件 (mapping.txt) 的路径
    文件'文本框。
  4. 将堆栈跟踪的副本粘贴到“模糊堆栈跟踪”中
    文本框。单击
  5. 右下角的“重新跟踪”。

调试愉快!

For mac user use bellow code to run the
/Users/XYZ/Library/Android/sdk/tools/proguard/bin/proguardgui.sh

  1. Run the GUI above from the path above.
  2. Click the 'ReTrace' button at the bottom of the panel on the left.
  3. Add the path to your Mapping File (mapping.txt) in the 'Mapping
    file' text box.
  4. Paste a copy of your stack trace in the 'Obfuscated stack trace'
    text box. Click
  5. 'ReTrace' in the bottom right.

Happy Debugging!

审判长 2024-12-11 07:58:05

获取混淆后的 apk 的步骤:

  1. proguard 站点下载最新的 proguard。当前最新版本是 proguard4.7

  2. C:\Program Files (x86)\Android\android-sdk\tools\proguard 的“bin”和“lib”文件夹替换为最新下载的 proguard 文件夹.

  3. 检查 Eclipse 中的 SDK 位置是否有空格,然后转到 Window > >首选项>安卓。如果有空格则替换为:

    c:\Progra~2\android\android-sdk(适用于 Windows 64 位)
    c:\Progra~1\android\android-sdk(适用于 Windows 32 位)
    
  4. 检查 proguard.cfg 文件是否位于项目的根文件夹中,并在 android 项目的 project.properties 文件中添加 proguard.config=proguard.cfg

  5. 现在导出您的项目以获取混淆的 apk。

Steps to get obfuscated apk:

  1. Download latest proguard from proguard site. Current latest version is proguard4.7

  2. Replace "bin" and "lib" folder of C:\Program Files (x86)\Android\android-sdk\tools\proguard with latest downloaded proguard folders.

  3. Check SDK location in eclipse for blank spaces in it and for that go to Window > Preferences > Android. If there is blank space then replace it with:

    c:\Progra~2\android\android-sdk (for windows 64-bit)
    c:\Progra~1\android\android-sdk (for windows 32-bit)
    
  4. Check that proguard.cfg file is in your project's root folder and add proguard.config=proguard.cfg in project.properties file of android project.

  5. Now export your project to get obfuscated apk.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文