Android Studio
ProGuard
Mapping File
Code Obfuscation
Debugging

Where does Android Studio save the ProGuard mapping file?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Android Studio does not store the ProGuard or R8 mapping file in some hidden IDE folder. The file is generated by the Gradle build and written into the module's build output directory, usually under a variant-specific path such as app/build/outputs/mapping/release/mapping.txt.

The Default Mapping File Location

For a standard Android app module named app, the most common location is:

text
app/build/outputs/mapping/release/mapping.txt

If you build another variant, the variant name changes the path:

text
app/build/outputs/mapping/debug/mapping.txt
app/build/outputs/mapping/paidRelease/mapping.txt
app/build/outputs/mapping/freeRelease/mapping.txt

The important rule is simple: the mapping file lives under the module's build/outputs/mapping/<variant>/ directory.

When The File Is Generated

The mapping file appears only when code shrinking or obfuscation is enabled for that build variant. In modern Android builds, R8 usually performs this work even though many developers still refer to it as a ProGuard mapping file.

A typical release configuration looks like this:

kotlin
1android {
2    buildTypes {
3        release {
4            isMinifyEnabled = true
5            isShrinkResources = true
6            proguardFiles(
7                getDefaultProguardFile("proguard-android-optimize.txt"),
8                "proguard-rules.pro"
9            )
10        }
11    }
12}

If isMinifyEnabled is false, no obfuscation step runs, so no mapping.txt file is produced.

Why The Mapping File Matters

The mapping file links obfuscated names back to your original classes and methods. That makes it essential for decoding crash reports from release builds.

For example, a stack trace may mention a class like a.b.c, which is useless by itself. The mapping file lets tools such as Crashlytics retrace the stack trace into the real symbol names from your source code.

That is why teams usually archive the mapping file for every release build. If you lose it, old obfuscated crash reports become much harder or impossible to decode correctly.

Find It From The Command Line

If you are unsure which module or variant produced the file, searching the project is faster than clicking through generated folders in the IDE.

bash
find . -path "*/build/outputs/mapping/*/mapping.txt"

Or, using a faster project search tool:

bash
rg --files | rg "mapping/.*/mapping\\.txt$"

That is useful in multi-module projects where the mapping file may exist in several module output directories.

Multi-Module And CI Considerations

In a larger project, each Android application module can generate its own mapping file. Library modules behave differently because they do not always produce the same kind of obfuscated application output.

In CI pipelines, the path is still based on the module build directory, but the actual absolute location depends on the checkout workspace. Teams commonly copy the mapping file to an artifact store after a successful release build.

A simple Gradle task often depends on release assembly, then publishes:

  • the APK or AAB
  • the mapping file
  • the exact git commit or version tag

That trio is enough to debug most production crash reports later.

R8 Versus ProGuard

Many developers still say "ProGuard mapping file," but recent Android builds typically use R8 as the shrinker and obfuscator. The output file is still named mapping.txt, and the location pattern is the same for practical purposes.

So if you are using a current Android Gradle Plugin, the answer is still the same: check the variant folder under build/outputs/mapping.

Common Pitfalls

The most common mistake is looking under the IDE configuration directories instead of the Gradle build output. Android Studio does not invent a separate mapping storage location for the project.

Another mistake is expecting the file after a debug build that does not enable minification. No shrinking means no mapping file.

Developers also sometimes forget that build/ is disposable. Running a clean build or switching CI agents can delete old mapping files, so release artifacts should be archived outside the build directory.

Finally, do not assume the variant is always release. Product flavors and custom build types change the path.

Summary

  • The mapping file is usually written to app/build/outputs/mapping/<variant>/mapping.txt.
  • It is generated by the Gradle build, not stored in a special Android Studio folder.
  • The file exists only for variants with minification or obfuscation enabled.
  • Archive it for every release so you can de-obfuscate production stack traces later.
  • In flavored or multi-module projects, check the specific module and variant directory.

Course illustration
Course illustration

All Rights Reserved.