R8
What it is
R8 is a free, open-source Java program optimizer that shrinks and minifies code while producing optimized DEX for Android. The same repository includes D8, which converts Java bytecode to DEX. R8 removes unreachable code and can reduce execution work through method inlining and class merging; it also shortens class, field, and method names to reduce DEX size. With Android Gradle Plugin 8.12.0 and later, its optimization phases can optimize resources. It accepts class files and can produce Android DEX or Java class files. Android Gradle Plugin includes R8, and users can replace its embedded version with a prebuilt or locally built JAR. R8 uses ProGuard-format configuration, with keep rules supplied in a file through --pg-conf. Stable and development builds are available from Google Maven and CI archives. The project recommends enabling optimization for a tested release build, while noting that it can lengthen builds and make debugging harder. The command line does not match ProGuard in every respect, including how keep rules are provided.
For and against
For
- Removes unreachable code and can inline methods
- Shortens names to reduce DEX file size
- Android Gradle Plugin includes R8
- Can output Android DEX or Java class files
Against
- Optimization can increase build time
- Optimization can make debugging harder
- Keep rules must be supplied in a configuration file
The verdict
R8 combines shrinking, minification, and optimization for Java programs, with D8 also included for bytecode-to-DEX conversion. Its build-time and debugging tradeoffs, plus its configuration differences from ProGuard, are worth accounting for before adoption.
Who it suits
R8 is for developers preparing Java or Android app builds who want to shrink and optimize code. Its documentation recommends using it on a tested release build, since optimization can make debugging harder and increase build time.
Plans and prices
R8
Open-source repository; prebuilt stable and development versions available
Read 11 Oct 2026 · r8.googlesource.com
On the record
- Android integration
- The Android Gradle plugin ships with R8 embedded, and the repository documents how to override that version.r8.googlesource.com · read 11 Oct 2026
- Build
- The documented source build uses Chromium depot_tools and produces a JAR containing both R8 and D8.r8.googlesource.com · read 11 Oct 2026
- Build requirements
- Building from source requires depot_tools and a Java 8 compiler and runtime; the documented IntelliJ setup points to a Linux JDK path.r8.googlesource.com · read 4 Oct 2026
- Compatibility limit
- R8 is not command-line compatible with ProGuard; keep rules must be passed in a configuration file using --pg-conf.r8.googlesource.com · read 11 Oct 2026
- Configuration
- R8 uses the ProGuard configuration format to configure whole-program optimization and application entry points.r8.googlesource.com · read 11 Oct 2026
- Contributions
- Contributors must sign a Contributor License Agreement, or a Corporate Contributor License Agreement when the contribution belongs to their employer.r8.googlesource.com · read 11 Oct 2026
- D8 modes
- D8 defaults to debug mode, and its release mode removes debugging information to produce smaller DEX files.r8.googlesource.com · read 11 Oct 2026
- Distribution
- Stable and development builds are available from Google Maven, and the project also documents CI archive downloads.r8.googlesource.com · read 4 Oct 2026
- Downloads
- Stable and development prebuilt versions are available from Google Maven and the project's CI archive.r8.googlesource.com · read 11 Oct 2026
- Input and output
- R8 consumes class files and can output DEX for Android apps or class files for Java apps.r8.googlesource.com · read 11 Oct 2026
- Integration
- Android Gradle Plugin ships with R8 embedded, and users can override the embedded version with a prebuilt or locally built JAR.r8.googlesource.com · read 4 Oct 2026
- Intended users
- The documentation describes R8 as an app optimizer and recommends enabling it for a tested release build, while warning that optimization can increase build time and make debugging harder.developer.android.com · read 4 Oct 2026
- Notable limitation
- The R8 command line is not compatible with ProGuard in every respect; for example, keep rules must be supplied in a file rather than on the command line.r8.googlesource.com · read 4 Oct 2026
- Obfuscation
- R8 shortens class, field, and method names to reduce DEX file size.developer.android.com · read 4 Oct 2026
- Optimization
- R8 removes unreachable code and can optimize execution through method inlining and class merging.developer.android.com · read 4 Oct 2026
- Other build systems
- R8 can be integrated into a Bazel build pipeline, though the Android Developers page says Bazel is not officially supported for Android app development.developer.android.com · read 4 Oct 2026
- Platform requirements
- The build instructions say the first run bootstraps Gradle and required JDKs, and Android-targeted R8 use requires an Android SDK platform android.jar.r8.googlesource.com · read 11 Oct 2026
- Product
- The repository contains D8, which converts Java bytecode to DEX, and R8, which shrinks and minifies Java programs while producing optimized DEX code.r8.googlesource.com · read 11 Oct 2026