Practical obfuscation guide
summary
R8 is Android’s default tool (since AGP 3.4.0) that does code shrinking, resource shrinking, optimization, and obfuscation to reduce APK size and enable aggressive inlining and dead‑code removal. It emits mapping.txt for restoring obfuscated stack traces via retrace or Firebase Crashlytics uploads. For libraries, avoid using @Keep (it stays in the binary and blocks shrinking); instead provide conditional ProGuard/consumer rules, and use templates, wildcards, bytecode inspection, and the R8 playground for practical debugging and tuning.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:47What is obfuscation
- 5:44Obfuscation in Android
- 6:05R8 features and enabling
- 9:20Config file role
- 13:16Tools history and R8 adoption
- 14:405 keep rules techniques
- 21:26Keep rules principles
- 24:20Checking Java bytecode
- 25:22Info gathering resources
- 27:48Analyzing obfuscated crashes
- 31:22Keep annotations and library notes
- 35:42Summary
related talks
27mFrom ProGuard to R8: Take Care of Your Bytecode
41mShrink, Secure & Optimize Your App With R8
36mMaster the Art of Code Obfuscation from Simple to Advanced
37mEffective ProGuard keep rules for smaller applications
33mHow ProGuard Works
28mEscaping from a 'It Kinda Works' ProGuard Setup
41mDigging into D8 and R8
18mTransforming App Security
