In the process of optimizing an Android application, Proguard obfuscates the names of packages, classes and methods; this makes applications smaller and faster to run but can also be used partly in order to make the application more difficult to understand to someone using decompilation tools.
This obfuscation is beneficial in most cases, but can make it difficult to understand a stacktrace appearing in a crash. Fortunately we can revert it in order to analyze it properly, using a "mapping file" that is generated during the build process.
Use the following steps in order to deobfuscate a stacktrace:
Finding your Android SDK
The tools you will need are located in the Android SDK folder. By default it is located in the following paths:
- In Windows:
C:\Program Files (x86)\Android\android-sdk
- In macOS:
~/Library/Android/sdk on MacOS
- In Linux:
Using the ProGuard GUI tool
- Locate and launch the application in
- Select the “ReTrace” option on the left column.
- Select your mapping file. You can find it in the following path on your build:
- Copy & paste your obfuscated stack trace from Bugfender the tool in the "Obfuscated stack trace" box.
- Click ‘Retrace’ button.
Command line Method
- Copy & paste your obfuscated stack trace from Bugfender to a text file (ex:
- Locate the the retrace tool in the Android SDK directory, it will be in
<android-sdk>/tools/proguard/bin/retrace.shor in Windows it will be
- Run the tool with the mapping.txt file and the stacktrace file:
retrace.sh mapping.txt stacktrace.txt
- The command will output the de-obfuscated stacktrace.
Recommended Proguard configuration for a good retrace
Even if the retrace tool is very powerful, depending on the degree of optimization performed it might not be possible to reconstruct the original stacktrace, even with the mapping file.
The following parameters are recommended in your