I switched over from Eclipse to Android Studio in the last few days and have gotten most everything working. However, when I generate a signed APK it appears as though ProGuard is never running.
I am using the Generate Signed APK Wizard, selecting 'Run ProGuard' and specifying my proguard.cfg as the config file. The build process runs without errors and generates a functional apk, but that apk is 65% larger than the one generated by Eclipse. When I generate the apk through Android Studio's APK Wizard and do not select 'Run Proguard' the resulting apk is the same size as the one that should have had ProGuard run on it. No mapping.txt, seeds.txt, or usage.txt is generated anywhere in my project directory. I have tried adding
buildTypes {
release {
runProguard true
proguardFile file('proguard.cfg')
proguardFile getDefaultProguardFile('project-android.txt')
}
}
and variations to my build.gradle file but that has had no effect either.
This is occurring on Android Studio 0.2.0, though I was seeing the same behavior on 0.1.9. I am working on Windows 7.
Can anyone tell me what might be going on? I would be happy if I could find the logs ProGuard is supposed to generate.
The getDefaultProguardFile('proguard-android. txt') method obtains the default ProGuard settings from the Android SDK tools/proguard/ folder. The proguard-android-optimize. txt file is also available in this Android SDK folder with the same rules but with optimizations enabled.
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 .
Just update your build.gradle
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
Details Reference. I hope it will helps you
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