Deobfuscation with proguard’s mapping.xml

Done with our work,tested all the features,no crash,all working great .

Uploaded on Play store. Relief!!!!

After few days,there is a random crash in your app,which you can’t generate but has been found in Crash Report of Play Console on frequent basis.

The error report generated produces output in which method names are obfuscated as specified below

10-17 10:03:10.488: E/AndroidRuntime(25723): Caused by: java.lang.NullPointerException
10-17 10:03:10.488: E/AndroidRuntime(25723): at sample.test.a.a(Unknown Source)

So how to tackle with this issue,there comes the Savior — PROGUARD

ProGuard creates a mapping.txt file each time it runs, which shows the original class, method, and field names mapped to the obfuscated names. ProGuard saves the file in the app <module-name>/build/outputs/mapping/release/ directory.

Remember mapping.txt is updated everytime you create a release build with proguard. So you can keep backup of this file with your every release

Steps to upload mapping.txt on playstore :

Simple steps executed & done with uploading mapping.txt

Now if any crash occurs in your app,error report will be generated in deofuscated manner.

Alternate Way

To convert the code by yourself use the retrace script (retrace.bat on Windows; retrace.sh on Mac/Linux). It is located in the <sdk-root>/tools/proguard/ directory. The script takes the mapping.txt file and your stack trace, producing a new, readable stack trace. The syntax for using the retrace tool is:

retrace.bat|retrace.sh [-verbose] mapping.txt [<stacktrace_file>]

Happy Coding :)

Before you go…

If you found this article helpful, click the💚 or 👏 button below or share the article on Twitter.