All Collections
Advanced usage
Deobfuscating a stacktrace
Deobfuscating a stacktrace

This article explains how to use a mapping.txt file to deobfuscate the stacktrace of a R8 or Proguard optimized application

Jordi Giménez avatar
Written by Jordi Giménez
Updated over a week ago

In the process of optimizing an Android application, R8 and Proguard obfuscate 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.

Uploading the mapping file to Bugfender

When you're seeing a crash, you might see a Mapping: missing indication next to the crash. You can use that button to upload your mapping file.

Automatically uploading the mapping file to Bugfender

You can use this Gradle plugin to automatically upload the mapping files when you build your application: https://github.com/bugfender/gradle-mapping-upload.

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 proguard.cfg  file:

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

Also, please note each version of the application will produce its own mapping file, which you need to upload to Bugfender separately.

Did this answer your question?