The next step in the release process is to enable code obfuscation. Open your build.gradle configuration and update it as follows:
... buildTypes { ... release { debuggable false minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro' } } ...
The configuration we just added will shrink resources and perform obfuscation. For the obfuscation, we will use ProGuard. ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It performs detection of unused classes, fields, methods, and attributes. It optimizes bytecode as well!
In most cases, the default ProGuard configuration (the one we use) is enough to remove all the unused code. However, it can happen for ProGuard to remove the code your app actually...