When you create a new project or module using Android Studio, the IDE creates a <module-dir>/proguard-rules.pro
file for you to include your own rules. You can also include additional rules from other files by adding them to the proguardFiles
property in your module’s build.gradle
file.
For example, you can add rules that are specific to each build variant by adding another proguardFiles
property in the corresponding productFlavor
block. The following Gradle file adds flavor2-rules.pro
to the flavor2
product flavor. Now, flavor2
uses all three ProGuard rules because those from the release
block are also applied.