Gradle
Also called build.gradle, Gradle wrapper
What is Gradle in React Native?
Gradle is the build system that compiles the Android side of a React Native app, resolving native dependencies and producing the APK or AAB you install or ship.
Gradle is the build tool Android uses, and in a React Native project it compiles everything under android/: your app module, React Native, Hermes and the Android half of each native library. It plays the role on Android that Xcode’s build system plays on iOS.
The files you will meet:
android/app/build.gradle— the app module:applicationId,versionCode,versionName, signing configs and dependencies.android/build.gradleandsettings.gradle— project-wide setup, including where autolinking plugs in native libraries.android/gradle.properties— flags such ashermesEnabled,newArchEnabledand the JVM memory Gradle may use.gradlewandgradle/wrapper/— the Gradle wrapper, which downloads the exact Gradle version the project expects.
Always run ./gradlew, never a globally installed gradle. The wrapper pins the version, and React Native, the Android Gradle Plugin and Gradle must be compatible with each other.
cd android
./gradlew assembleDebug # debug APK
./gradlew bundleRelease # release AAB for Google Play
npx react-native run-android and npx expo run:android call these tasks for you. The output lands in android/app/build/outputs/ as an APK or Android App Bundle.
Gotchas worth knowing:
- The first build is slow because Gradle downloads dependencies and compiles every architecture. Later builds reuse its cache and daemon.
- “Could not resolve” errors usually mean a version mismatch between a library and your React Native version, not a network problem.
./gradlew cleanfixes stale outputs, but deletingandroid/.gradleandandroid/app/buildis sometimes needed after an upgrade.- In Expo projects using Continuous Native Generation, edit Gradle settings through
app.jsonor config plugins, becauseandroid/is regenerated.