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
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 .
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.
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.
Remove -dontobfuscate from the whole project and you will get your mapping file generated under build/outputs/mapping/..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With