Back to Glossary

R8

R8 is Android's modern code shrinker and obfuscator that replaced ProGuard, offering faster build times and better optimization for reducing APK size and protecting code.

R8 is Google’s current-generation code shrinking, optimization, and obfuscation tool that became Android’s default compiler with Android Studio 3.4. Built to replace ProGuard with improved performance and deeper Android-specific optimizations, R8 converts Java bytecode to optimized Dex format while simultaneously performing dead code elimination, code optimization, and name obfuscation in a single compilation pass. This integrated approach results in faster build times, smaller APK sizes, and better runtime performance compared to ProGuard’s multi-stage processing.

R8 maintains backward compatibility with ProGuard rules while adding Android-specific optimizations like more aggressive inlining, class merging, and vertical class merging that reduces method counts and improves app startup time. The tool produces more compact Dex files through enhanced constant folding, unused argument removal, and class and interface optimization. Like ProGuard, R8 generates mapping files essential for deobfuscating stack traces in crash reports, but offers better handling of Kotlin-specific features, coroutines, and modern Android development patterns.

Developers enable R8 through build.gradle configuration with minifyEnabled true, customize behavior through proguard-rules.pro files using familiar ProGuard syntax, and benefit from Google’s curated optimization database that provides default keep rules for common Android libraries and frameworks. R8’s full mode offers even more aggressive optimizations beyond ProGuard compatibility, though it may require additional testing to ensure app stability across diverse device configurations and Android versions.

Want to learn more about app development?

Explore our complete glossary of 182 terms covering everything from mobile development to deployment.

Browse All Terms