Use R8 To Shrink, Optimize, and Speed Up Apps
Article Summary
Ben Weiss from Google reveals the single most impactful, low-effort change you can make to Android app performance. Reddit saw 40% faster cold startup and Disney+ cut ANRs by 25% with one configuration tweak.
Google's Android Performance Spotlight Week kicks off with a deep dive into R8, the optimizer that does far more than shrink app size. While most developers know R8 for removing unused code, its real power lies in whole-program optimizations that fundamentally rewrite code for efficiency.
Key Takeaways
- Reddit achieved 40% faster startup and 30% fewer ANRs after enabling R8 full mode
- Disney+ saw 30% faster startup by replacing one default configuration file
- R8 performs method inlining, class merging, and tree shaking for runtime gains
- Many apps still use proguard-android.txt which contains the -dontoptimize flag
- AGP 9.0 adds automatic stack trace de-obfuscation in Android Studio logcat
Critical Insight
Enabling R8's full mode delivers measurable performance wins (25-40% improvements) with minimal code changes, yet many apps still have optimization accidentally disabled.