Identify what the build actually runs
In a current Android Gradle Plugin project, enabling code optimization invokes R8. A file named proguard-rules.pro does not prove that the ProGuard executable ran: R8 consumes compatible rules from that file.
Use the Android optimization documentation for Android configuration and the ProGuard manual for a standalone ProGuard pipeline. Mixing commands from the two can create misleading diagnostics.
Compare the responsibilities
| Question | R8 in an Android build | Standalone ProGuard |
|---|---|---|
| Typical integration | Android Gradle Plugin | Java build or explicit integration |
| Output context | Android deployment pipeline | Processed Java bytecode |
| Rules | ProGuard-compatible rules with documented differences | ProGuard configuration |
| Debugging evidence | R8 diagnostics and matching mapping | ProGuard diagnostics and matching mapping |
Both can remove unused code and rename symbols. Neither turns an embedded API secret into a safe secret.
Migrate rules, not assumptions
Start with the rules actually required by reflection, serialization, native interfaces and libraries. Remove obsolete broad keeps only with release tests. The keep-rule guide explains why retaining every class defeats much of the optimizer's value.
A third-party library may already supply consumer rules. Check those before adding a second app-wide rule that keeps an entire package. A rule that once worked around an old optimizer bug may no longer be necessary, but deleting it without reproducing its original case is also risky.
Compare release outcomes
Measure the same variant, resources, ABI configuration and dependency set. Compare artifact size, startup and critical flows after shrinking. A smaller APK with broken reflective deserialization is not an improvement.
Archive mapping files for each distributed release. Debug builds do not exercise the same optimization behavior and cannot establish release compatibility.
Use inspection as a supporting signal
APKLint's ProGuard / R8 checker can highlight likely obfuscation characteristics. It cannot identify every transformation or certify that your rules are correct. The decisive evidence is a successful optimized build, representative runtime tests and usable crash deobfuscation.
Sources and further reading
- Android Developers: Enable optimization with R8
- Android Developers: Add keep rules
- ProGuard manual — Guardsquare
Reference review: 22 September 2026. Examples illustrate the workflow; check your installed versions, release artifact and account-specific Console requirements before applying them. This guide is not a claim that APKLint executed your project or verified your private account.



