R8 (người kế nhiệm hiện đại của ProGuard) shrink code không dùng (tree shaking), obfuscate tên class/method để bảo mật, và optimize code cho runtime performance.
- Chạy trong release build, giảm đáng kể kích thước app và thời gian khởi động.
- R8 đã bật mặc định từ AGP 3.4 — không cần thêm
android.enableR8 = truetrong gradle.properties với AGP hiện tại (8.x). - Hiểu cách cấu hình rules R8 rất quan trọng cho production release.
R8 (the modern successor to ProGuard) shrinks unused code (tree shaking), obfuscates class/method names for security, and optimizes code for runtime performance.
- It runs during the release build, significantly reducing app size and startup time.
- R8 has been enabled by default since AGP 3.4 — the
android.enableR8 = truegradle.properties flag is legacy and does nothing in current AGP (8.x). - Understanding R8 rules configuration is critical for production releases.