I am using Android Studio since 0.1.0 ... I just learned yesterday that Pro Guard seems to be integrated in newly created projects. Unfortunately this is not true for my pro
You can copy the default Proguard configuration file to your project.
sdk-location/tools/proguard/examples/android.pro — copy and paste it as proguard.cfg in your project. Then choose it when AS asks for the config file path.
I was also not able to do it through Android Studio. However, this worked for me.
Add the following sections to the "android" section of your build.gradle file, filling in your own implementation details where appropriate.
android {
...
signingConfigs {
releaseConfig {
storeFile file("/dir/to/your.keystore")
storePassword "xxx"
keyAlias "yyy"
keyPassword "xxx"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../your_proguard_file.txt'
signingConfig signingConfigs.releaseConfig
}
}
}
In your project folder, run ./gradlew clean and ./gradlew assembleRelease
The complete ProGuard configuration that is generated by your rules (.pro
) file can be saved by appending the -printconfiguration
command to your existing rules. i.e.
-printconfiguration 'C:\Example\File\Path\proguard-configuration.txt'