How do you deobfuscate an Android stack trace?

← Android answers

Keep the mapping.txt file that R8 or ProGuard produced for that exact build, then run the retrace tool on the stack trace.

When minification is on, class and method names are replaced with short ones like a.b.c. The build writes a mapping file that records how to reverse that, and it is regenerated on every build, so a trace is only readable with the mapping of the build that produced it.

# Mapping file location after a release build
app/build/outputs/mapping/release/mapping.txt
 
# Restore names (retrace ships with the Android command-line tools)
retrace mapping.txt crash-trace.txt
  • Archive mapping.txt for every release you publish. Google Play can also store it if you upload it with the app bundle.
  • Add -keepattributes SourceFile,LineNumberTable so line numbers survive minification.
  • Android Studio's Analyze > Stack Trace or Thread Dump can retrace a pasted trace using a mapping file you point it to.
Upload the mapping file with your build and Bugsee deobfuscates Android crashes automatically. Learn more

Related questions

Start debugging smarter today

Try Bugsee for free — no commitments, no hidden fees.

Free sign upLive demoNo credit card required