
What is React Native Gradle Plugin?
The React Native Gradle Plugin is a modern build tool developed by the React Native team to enhance and manage the Android build process for React Native applications. Introduced officially with React Native 0.71+, this plugin is part of the shift toward modularization, speed, and configurability in React Native’s Android build pipeline.
Built as a standard Gradle plugin, it enables developers to:
- Configure build behaviors declaratively,
- Minimize boilerplate in
build.gradle
files, - Improve build performance,
- Manage package list generation, Hermes settings, and resource shrinking.
The plugin simplifies the integration between React Native’s JavaScript/Java/Kotlin codebases and Android Gradle tasks — reducing complexity, build size, and time, especially in production releases.
What are the Major Use Cases of React Native Gradle Plugin?
The plugin supports several key development and deployment needs in the React Native Android ecosystem:
1. Automatic Package List Generation
- Replaces the need to manually manage the list of packages in
MainApplication.java
by generating it during the build.
2. Hermes Engine Management
- Easily toggle Hermes (React Native’s JavaScript engine) without manually editing multiple files.
3. Release Build Optimization
- Configure
minifyEnabled
,shrinkResources
, and Proguard/R8 rules directly via plugin config.
4. Support for Modularized Projects
- Makes multi-module Android projects using React Native more manageable and standardized.
5. Custom Build Profiles
- Define custom configurations for staging, QA, or CI environments with different JS bundles or settings.
6. Improved CI/CD Integration
- Provides a structured way to enable/disable build features during automated builds, speeding up delivery pipelines.
How React Native Gradle Plugin Works (with Architecture)

The React Native Gradle Plugin is applied in your app’s build.gradle.kts
or build.gradle
file and configures React Native-specific settings during the Gradle sync and build phases. It interacts with:
- The
react.gradle
script, - Java/Kotlin Android sources,
- React Native libraries and modules,
- JavaScript bundle builds via Metro.
Simplified Architecture:
[build.gradle.kts/.groovy]
↓
[React Native Gradle Plugin]
↓
[Gradle Configuration Phase]
↓
[Build Tasks]
├─ JS Bundle Creation (via Metro)
├─ Hermes Compilation
├─ Resource Minification
├─ Proguard/R8
└─ Package List Auto-generation
- The plugin hooks into the Gradle lifecycle, executes early during the configuration phase, and sets up all required React Native build tasks.
- It allows JavaScript bundle configuration to be co-located with Android settings.
- Uses Gradle’s type-safe DSL (in Kotlin) for easier management in large teams or Android-heavy environments.
What is the Basic Workflow of React Native Gradle Plugin?
- Configure the Plugin
- Apply the plugin to your Android app module.
- Set required flags for Hermes, shrinkResources, etc.
- Sync Project
- Gradle reads the plugin’s DSL and sets up tasks accordingly.
- Build Process
- The plugin generates JavaScript bundles using Metro.
- It auto-generates native package list classes.
- Runs Hermes bytecode compilation if enabled.
- Applies R8/Proguard optimizations.
- App Output
- Produces an optimized
.apk
or.aab
(Android App Bundle) for development or release.
- Produces an optimized
Step-by-Step Getting Started Guide for React Native Gradle Plugin
Step 1: Upgrade to React Native 0.71+
Make sure your project uses React Native version 0.71 or later:
npx react-native --version
Step 2: Enable the Gradle Plugin in build.gradle.kts
In your android/app/build.gradle.kts
(Kotlin DSL):
plugins {
id("com.android.application")
id("com.facebook.react") version "0.71.0" apply true
}
For Groovy-based projects:
plugins {
id 'com.android.application'
id 'com.facebook.react' version '0.71.0' apply true
}
Step 3: Configure the Plugin
Add a react
block inside your android/app/build.gradle.kts
:
react {
jsRootDir.set(file("../"))
entryFile.set("index.js")
enableHermes.set(true)
codegenDir.set(file("../android/app/src/main/java/com/example/codegen"))
}
Options you can configure:
enableHermes
: Enable Hermes JS enginejsRootDir
: Path to your JS codeentryFile
: Main JS file for bundlingbundleAssetName
: Custom bundle outputcodegenDir
: Codegen output path for TurboModules
Step 4: Sync and Build
Sync the Gradle project:
./gradlew clean
./gradlew assembleRelease
You’ll see the plugin executing tasks like:
generatePackageList
createBundleReleaseJsAndAssets
compileReleaseJavaWithJavac
mergeReleaseResources
Step 5: CI/CD Integration (Optional)
Use environment flags in your CI for headless builds:
./gradlew assembleRelease -PdisablePreDex=true -PreactNativeArchitectures=arm64-v8a