Building an APK in React Native involves a few essential steps to ensure that your Android project is configured correctly and ready for release. This guide will walk you through the process of cleaning up potential problems, building the APK, and addressing common issues you might encounter during the build.
Updated for 2026: tested against the current React Native release line (0.88). Use JDK 17 for Android builds. If you see Java version errors, follow this Gradle JDK fix first.
1. Clean Project and Fix Problems
Before building the APK, it’s good practice to clean the project and address any problems that may have occurred. This ensures a smooth build process and prevents issues caused by outdated caches or configurations.
Commands:
# Clean Gradle cache and ensure the project is fresh
./gradlew clean
# Start the React Native server to check for any issues
npx react-native start
# Run the React Native Doctor to check your environment setup
npx react-native doctor./gradlew cleanwill remove any cached Gradle files, ensuring that the next build is fresh.npx react-native startwill restart the Metro bundler.npx react-native doctorhelps identify any environment setup issues such as missing Android SDK components or mismatched versions.
2. Fix Dependency Issues
Sometimes there can be security vulnerabilities or outdated packages in your project. Running npm audit helps to identify and resolve these issues.
Command:
# Automatically fix security vulnerabilities and dependency issues
npm audit fix
This will address any known security vulnerabilities in your project dependencies.3. Navigate to Android Folder
The Android build process for React Native requires working from the android directory within your project.
Command:
# Move into the Android project directory
cd android
4. Build the APK
You have two options to build your APK: using npx react-native or Gradle commands.
Option 1: Using React Native CLI
# Build the APK using React Native CLI
npx react-native build-androidOption 2: Using Gradle Command
For more control over the build process, you can use Gradle directly:
# Build the release APK using Gradle
./gradlew assemblerelease
This command will generate the APK in the android/app/build/outputs/apk/release/ directory of your project.
5. Debugging Build Issues
If you encounter build errors, here are some common steps to resolve them:
- Rebuild from Clean State: If the build fails, try running
./gradlew cleanagain and then rebuild the project. - Check for Missing Dependencies: Ensure that all required Android SDKs and dependencies are installed. You can verify this using
npx react-native doctor. - Update React Native and Dependencies: Sometimes an outdated React Native version or third-party dependencies cause issues. Update your packages using:
npm install react-native@latest- Check for Java and Android SDK versions: Make sure that your Java JDK version and Android SDK are correctly set up in
local.propertiesandgradle.properties.
6. Testing the APK
Once the APK is built, it’s important to test it on an Android device or emulator.
To install the APK on your device:
- Connect your Android device or start an emulator.
- Run the following command to install the APK on the device:
adb install android/app/build/outputs/apk/release/app-release.apk
This will install the APK to your connected device or running emulator, allowing you to test it directly.
7. Signing the APK for Release
If you’re planning to distribute your APK through the Google Play Store, you’ll need to sign your APK.
Steps for signing the APK:
Generate a Signing Key
keytool -genkey -v -keystore release-key.keystore -alias your-key-alias -keyalg RSA -keysize 2048 -validity 10000 This will generate a key that you’ll use to sign the APK.
Configure Gradle to Sign the APK:
Add the following to your android/app/build.gradle file under the android section:gradle
signingConfigs { release { storeFile file('path-to-keystore') storePassword 'your-store-password' keyAlias 'your-key-alias' keyPassword 'your-key-password' } } buildTypes { release { signingConfig signingConfigs.release minifyEnabled false shrinkResources false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }Build the Signed APK:
./gradlew assembleReleaseAPK or AAB: which one do you need?
- APK (
.apk): install directly on a phone, share with testers, or upload to stores that accept APKs. - AAB (
.aab, Android App Bundle): required by Google Play for new apps. Play generates optimized APKs for each device from it, so users download less.
Build commands and where the file ends up
cd android
# Release APK
./gradlew assembleRelease
# Output: android/app/build/outputs/apk/release/app-release.apk
# Release AAB for Google Play
./gradlew bundleRelease
# Output: android/app/build/outputs/bundle/release/app-release.aab
# On Windows, use gradlew instead of ./gradlewGradle task names are case-sensitive, so type assembleRelease with a capital R.
Install the release APK on your phone
# With your phone connected over USB (or ADB over Wi-Fi)
adb install -r android/app/build/outputs/apk/release/app-release.apk
# Or build, install and launch the release version in one step
npx react-native run-android --mode releaseNo USB cable? See how to connect your Android device to ADB over Wi-Fi.
Build a smaller APK for quick testing
By default, the release APK includes native code for every CPU type. Most modern phones are arm64-v8a, so for a faster build and smaller test file you can build just that one:
./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8aSign your app before publishing
A fresh React Native template signs release builds with the debug key. That’s fine for testing, but Google Play needs your own upload key. Generate one once and keep it safe; if you lose it, you can’t easily ship updates. Full steps: How to generate and use a release key in React Native.
keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000Want your output file named like MyApp-v1.2.0.apk instead of app-release.apk? See how to customize the APK naming convention.
Common React Native APK build errors
- SDK location not found: Gradle can’t find your Android SDK. Fix it with local.properties or ANDROID_HOME.
- Unsupported class file major version 65 or requires Java 17: wrong JDK. Point Gradle to JDK 17.
- Duplicate resources during
mergeReleaseResources: you probably ranreact-native bundleintoandroid/app/src/main/researlier. Delete the generateddrawable-*andrawfolders it created, then build again. Release builds bundle JavaScript automatically. - App opens then crashes (but debug works): run
adb logcat *:Ewhile opening the app to see the real error. Also see how to solve Metro connection problems and crashes after release. - Build is stuck or behaves strangely after changing configs: run
./gradlew --stop, then./gradlew clean, and build again.
Google Play requirements to know in 2026
- New apps must be uploaded as an AAB, not an APK.
- Since November 1, 2025, apps targeting Android 15+ must support 16 KB memory page sizes. Recent React Native versions are already compliant, so keep React Native and your native libraries up to date.
- Play requires a recent
targetSdkVersion. The current React Native template sets this for you, which is another reason to upgrade older projects.
FAQ
Can I build an APK without Android Studio?
Yes. You need the Android SDK and JDK 17 installed, but the build itself is just ./gradlew assembleRelease in a terminal.
How do I build an APK with Expo?
Use EAS Build with a build profile that sets "buildType": "apk", or run npx expo prebuild and then use the Gradle commands above.
Why is my APK so big?
It includes native libraries for every CPU architecture. Upload an AAB to Play so each user only downloads what their phone needs, and use the single-architecture command above for testing.
8. Conclusion
Building an APK in React Native is a straightforward process, but it’s important to follow best practices to avoid issues. Always clean the project before building, fix any dependency or environment issues, and follow the correct steps to build and sign the APK if needed.
By following this guide, you’ll be able to build and distribute your React Native APK with confidence.






Bravo, this remarkable phrase is necessary just by the way
In it something is. Thanks for an explanation. All ingenious is simple.
Clearly, thanks for the help in this question.
Bravo, what excellent answer.
Предлагаю Вам зайти на сайт, на котором есть много статей по этому вопросу.
Doubly it is understood as that
I am really impressed together with your writing talents as well as with the format in your blog. Is this a paid topic or did you customize it your self? Anyway stay up the excellent high quality writing, it’s rare to peer a nice weblog like this one today!