Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mapping.txt file is not getting generated when using Proguard

I am facing issue while obfuscating my app using proguard.

I am able to use proguard and it is generating mapping.txt when i am creating a new application in android studio, however mapping.txt is not being generated when i am trying to use proguard on a project migrated from eclipse to android studio.

Following is my proguard-rules.pro file

-dontobfuscate
-dontshrink
-keepdirectories
-keeppackagenames javax.mail.**
-keeppackagenames javax.activation.**
-keeppackagenames com.sun.mail.**
-keeppackagenames myjava.**
-keeppackagenames org.apache.harmony.**
-keeppackagenames mailcap.**
-keeppackagenames mimetypes.**
-keep class javamail.** {*;}
-keep class javax.mail.** {*;}
-keep class javax.activation.** {*;}
-keep class javax.mail.internet.** {*;}

-keep class com.sun.mail.dsn.** {*;}
-keep class com.sun.mail.handlers.** {*;}
-keep class com.sun.mail.smtp.** {*;}
-keep class com.sun.mail.util.** {*;}

-keep class javax.ws.rs.** { *; }

-keep class mailcap.** {*;}
-keep class mimetypes.** {*;}
-keep class myjava.awt.datatransfer.** {*;}
-keep class org.apache.harmony.awt.** {*;}
-keep class org.apache.harmony.misc.** {*;}

-dontwarn com.fasterxml.jackson.**
-dontwarn java.awt.**
-dontwarn java.beans.Beans
-dontwarn javax.security.**

-ignorewarnings
-printmapping build/outputs/mapping/release/mapping.txt
like image 310
Bhagyashri Avatar asked Aug 19 '15 07:08

Bhagyashri


People also ask

Where is mapping txt file?

It should be located at build/outputs/proguard/release/mapping. txt in your application module's directory. In the latest version of ProGuard and Android Studio, the file is located at build/outputs/mapping/release/mapping. txt .

How do I create a map file?

Select Tools > Generate, or press Ctrl+G. The Generate Mapping File dialog appears. Enter the reader and writer parameters you want to use for the mapping file. Parameters:When you select certain source formats, the Parameters button becomes available.

What is ProGuard txt file?

The getDefaultProguardFile('proguard-android.txt') will retrieve the ProGuard settings that are stored in the Android SDK in tools/proguard. The proguard-rules.pro is a file that is located at the root of the module. The purpose is to allow you to add custom rules (ProGuard) that are specific to the module.


1 Answers

Remove -dontobfuscate from the whole project and you will get your mapping file generated under build/outputs/mapping/..

like image 117
Meriam Avatar answered Oct 30 '22 11:10

Meriam