I have read multiple threads on SO but couldn't find any answer. I have multiple questions here. Let me describe:
minifyEnabled
is false
in my Gradle file. Does this disable ProGuard completely?Then I read somewhere about proguard-rules.pro
file. It just had some comments and no code. Then I put this in it: -printmapping mapping.txt
. Then generated signed APK again, still no success. What am I missing?
Edit 1: If I have to execute some adb terminal command, please describe steps. I have never used Terminal before.
By default, this file is located at the root of the module (next to the build. gradle file).
In the release block on the example, minifyEnabled refers to the automatic removal of unused resources in the packaged app. If true, Gradle also removes resources from dependent libraries if they are not needed. This only works if the shrinkResources property is also set to true.
try to check setting -> InstantRun... it must be disabled :)
In your gradle file you must specifically set the minifyEnabled option to true.
This enables obfuscation. By doing so, it also applies the obfuscation rules that you define on your 'proguard-rules.pro' file.
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
You can print the mapping and the seeds used (note that you need both to fully decode/understand the encrypted code) by applying the respective commands
-printseeds obfuscation/seeds.txt
and
-printmapping obfuscation/mapping.txt
An example of a basic proguard file is :
-optimizationpasses 5
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*
-verbose
-dump obfuscation/class_files.txt
-printseeds obfuscation/seeds.txt
-printusage obfuscation/unused.txt
-printmapping obfuscation/mapping.txt
Regards,
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