---
title: "How do you deobfuscate an Android stack trace?"
description: "Release builds shrunk by R8 or ProGuard have unreadable stack traces. Use the build's mapping.txt with retrace to restore class and method names."
url: "https://bugsee.com/answers/android/deobfuscate-a-stack-trace/"
---

# How do you deobfuscate an Android stack trace?

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.

```bash
# 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. https://bugsee.com/android-crash-report/

## Related questions

- [How do you fix "lateinit property has not been initialized" in Kotlin?](https://bugsee.com/answers/android/fix-lateinit-property-not-initialized/)
