R8
r8.googlesource.com
- Free plan
- Linux
- API
What R8 is
R8 is a free, open-source Java optimizer and minification tool for Android and Java builds. It converts Java bytecode into optimized DEX code, removes unreachable code, and can improve execution through method inlining and class merging. It shortens class, field, and method names to reduce DEX size. Its optimization phases can also optimize resources with Android Gradle Plugin 8.12.0 and later. The same repository includes D8, which converts Java bytecode to DEX. R8 accepts class files and can produce Android DEX or Java class files. Android Gradle Plugin includes an embedded R8 version, and users can replace it with a prebuilt or locally built JAR. Configuration follows the ProGuard format, with keep rules supplied through a file using --pg-conf. Stable and development builds are available from Google Maven and documented CI archives. R8 can integrate with Bazel, although Android Developers does not officially support Bazel for Android app development. The project recommends optimization for tested release builds, while warning of longer builds and harder debugging.
Who it suits
R8 suits Android and Java developers who need shrinking, obfuscation, minification, or DEX generation in a build pipeline. It is also relevant to teams using Android Gradle Plugin or a self-managed command-line build.
Good to know, and what to watch
- Removes unreachable code
- Supports method inlining and class merging
- Produces optimized Android DEX
- Embedded in Android Gradle Plugin
- Free open-source repository
- Optimization can increase build time
- Debugging can become harder
- Not fully command-line compatible with ProGuard
- Source builds require depot_tools and Java 8
Plans
Every plan and priceR8
Open source
The verdict
R8 provides code shrinking, minification, obfuscation, and DEX generation for Android and Java workflows. Its Android Gradle Plugin integration is convenient, but configuration and build requirements deserve attention.
What the maker publishes
- Android integration
- The Android Gradle plugin ships with R8 embedded, and the repository documents how to override that version. source
- Build
- The documented source build uses Chromium depot_tools and produces a JAR containing both R8 and D8. source
- 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. source
- Compatibility limit
- R8 is not command-line compatible with ProGuard; keep rules must be passed in a configuration file using --pg-conf. source
- Configuration
- R8 uses the ProGuard configuration format, and keep rules are passed in a configuration file using the --pg-conf option. source
- Configuration
- R8 uses the ProGuard configuration format to configure whole-program optimization and application entry points. source
- Contributions
- Contributors must sign a Contributor License Agreement, or a Corporate Contributor License Agreement when the contribution belongs to their employer. source
- D8 modes
- D8 defaults to debug mode, and its release mode removes debugging information to produce smaller DEX files. source
- Distribution
- Stable and development builds are available from Google Maven, and the project also documents CI archive downloads. source
- Downloads
- Stable and development prebuilt versions are available from Google Maven and the project's CI archive. source
- Input and output
- R8 consumes class files and can produce DEX for Android apps or class files for Java apps. source
- Input and output
- R8 consumes class files and can output DEX for Android apps or class files for Java apps. source
- Integration
- Android Gradle Plugin ships with R8 embedded, and users can override the embedded version with a prebuilt or locally built JAR. source
- 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. source
- 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. source
- Obfuscation
- R8 shortens class, field, and method names to reduce DEX file size. source
- Optimization
- R8 removes unreachable code and can optimize execution through method inlining and class merging. source
- 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. source
- 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. source
- Product
- The repository contains D8, which converts Java bytecode to DEX, and R8, which shrinks and minifies Java programs while producing optimized DEX code. source
- R8 compiler
- R8 is a whole-program optimizing compiler focused on reducing program size. source
- Resource optimization
- R8 optimizes resources as part of its optimization phases with Android Gradle Plugin 8.12.0 and later. source
- Security and compliance
- The opened R8 project page contains no security or compliance claims. source
- Support
- The project directs users to [email protected] for questions and to separate issue trackers for D8 and R8. source
Checked against the maker's pages on 11 Oct 2026.