To enable code shrinking with ProGuard, add minifyEnabled true to the appropriate build type in your build.gradle file.
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile(‘proguard-android.txt'),
'proguard-rules.pro'
}
}
}
where:
minifyEnabled true : enable code shrinkinggetDefaultProguardFile(‘proguard-android.txt') method gets the default ProGuard settings from the Android SDKproguard-rules.pro file is where you can add custom ProGuard rules