Use build option isMinifyEnabled = true to minify the final APK.
Also add isShrinkResources = true to enable resource shrinking.
AGP will do :
- Code shrinking (or tree-shaking)
- Resource shrinking
- Optimization
- Obfuscation (or identifier minification)
See: https://developer.android.com/build/shrink-code