Howto in eclipse debugs obfuscated apk proguard file

I got crashed in my application after using Proguard and signing and exporting with a new key.
The same code works in normal eclipse debugging mode.

I read wherever I have to use the mapping.txt file to find the failed code. But how to do this, I have google this for 2 hours and no answer is working.

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

Is it correct? Any help would be resolved.

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

"When your running code prints a stack trace, obfuscation method names, which makes debugging ha"

What is a "stack trace" and where?

On the Proguard Manual page, I cannot find an explanation

+8
android proguard
source share
4 answers

Not inside Eclipse.

Outside of Eclipse, use the Retrace feature in ProGuard. You will also need the dumped stacktrace and mapping.txt found in your proguard project to undo stacktrace obfuscation. Remember to save a copy of mapping.txt (preferably outside the workspace of your project) each time you deploy a new version of your Android application.

+4
source share

Using the Proguard GUI, you can more efficiently photograph the stack trace. You will find this with your Android SDK.

 sdk\tools\proguard\bin\proguardgui.bat 
  • Launch the GUI above the path above.
  • Click the "ReTrace" button at the bottom of the left panel.
  • Add the path to the mapping file (mapping.txt) in the "Mapping file" text box.
  • Paste a copy of the stack trace into the Stack Obfuscation text box.
  • Click "ReTrace" in the lower right.
  • Happy debugging!

enter image description here

+7
source share

Having looked at this, the documentation for proguard on the Android developer site demonstrates how to decode the stack trace, but it does not indicate how to get the stack trace.

http://developer.android.com/guide/developing/tools/proguard.html (see Decoding Stack Obfuscation Tracks)

I tried using a logcat dump like this: -

 E/AndroidRuntime(14584): FATAL EXCEPTION: main E/AndroidRuntime(14584): java.lang.ExceptionInInitializerError E/AndroidRuntime(14584): at com.aabadg.<init>(Unknown Source) E/AndroidRuntime(14584): at com.aabaqa(Unknown Source) E/AndroidRuntime(14584): at com.aabaya(Unknown Source) E/AndroidRuntime(14584): at com.aabaya(Unknown Source) E/AndroidRuntime(14584): at com.aabaaq.get(Unknown Source) E/AndroidRuntime(14584): at com.aabcp.a(Unknown Source) E/AndroidRuntime(14584): at com.aabai.c(Unknown Source) E/AndroidRuntime(14584): at com.aabbg.a(Unknown Source) E/AndroidRuntime(14584): at com.aaaoa(Unknown Source) E/AndroidRuntime(14584): at com.aabee.a(Unknown Source) E/AndroidRuntime(14584): at com.aabag.a(Unknown Source) E/AndroidRuntime(14584): at com.aabcb.a(Unknown Source) 

Unfortunately, this will not work, but it works if I remove E / AndroidRuntime (14584) from the beginning of every line in which it works:

 FATAL EXCEPTION: main java.lang.ExceptionInInitializerError at com.aabadg.<init>(Unknown Source) at com.aabaqa(Unknown Source) at com.aabaya(Unknown Source) at com.aabaya(Unknown Source) at com.aabaaq.get(Unknown Source) at com.aabcp.a(Unknown Source) at com.aabai.c(Unknown Source) at com.aabbg.a(Unknown Source) at com.aaaoa(Unknown Source) at com.aabee.a(Unknown Source) at com.aabag.a(Unknown Source) at com.aabcb.a(Unknown Source) 

Since the documentation states that you need a stack trace file, and there seems to be no indication of getting the correct stack trace file from the device.

The only way I've seen this is to provide a special exception handler and write the stack trace to the SD card.

+4
source share

Steps to get obfuscation apk:

  • Download the latest version of proguard from the proguard website . Current latest version - proguard4.7

  • Replace the bin and lib folder with C:\Program Files (x86)\Android\android-sdk\tools\proguard with the latest proguard folders loaded.

  • Check the location of the SDK in eclipse for spaces in it, and for that go to Window> Preferences> Android. If there is empty space, replace it with:

     c:\Progra~2\android\android-sdk (for windows 64-bit) c:\Progra~1\android\android-sdk (for windows 32-bit) 
  • Make sure the proguard.cfg file is in the root folder of the project and add proguard.config=proguard.cfg to the project.properties file of the android project.

  • Now export your project to get obfuscation apk.

-5
source share

All Articles