📱 React Native Build Guide - Android
Generate development and production APK/AAB builds across Linux, Mac, and Windows.
Linux (Ubuntu, Fedora, etc)
🛠️ Development Builds (Testing)
Ensure emulator is running
Run this from your Expo (React Native) root directory:
npx expo run:android
this creates the native ./android directory
Live Reloading (default)
Debug build with real-time updates is installed automatically on emulator.
Test release variant of development build
To simulate a release-mode dev build, first remove the native Android directory and reinit:
rm -rf android
npx expo run:android --variant release
APK Output: android/app/build/outputs/apk/release/app-release.apk
🚀 Production Builds (APK & AAB)
Run release prebuild
Prepare a release-ready native project:
npx expo prebuild --clean
Automatically cleans up previous android and ios builds and builds again afresh.
Optionally -> Manualy clean up previous builds
To begin production builds, first remove the native /android and (optionaly) /ios directory:
rm -rf android
rm -rf ios
npx expo prebuild
Clean and recreate builds (Manually)
Use this part if there were settings customized on development Clean old builds
Remove previously generated APKs:
cd android
./gradlew clean
This cleans all builds made previously while maintainig originally customized code.
Generate Keystore
From the terminal: on /android
cd app
keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
ensure the file in android/app.
Edit android/gradle.properties
Add the following lines:
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore MYAPP_UPLOAD_KEY_ALIAS=my-key-alias MYAPP_UPLOAD_STORE_PASSWORD=your-store-password MYAPP_UPLOAD_KEY_PASSWORD=your-key-password
Edit android/app/build.gradle
Add signing config blocks:
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Optional: SDK Version Setup
buildscript {
ext {
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 29
}
}
This will help customize bundling of your build to target most devices.
Build AAB (Play Store)
./gradlew bundleRelease
Output: android/app/build/outputs/bundle/release/app-release.aab
Build APK (Direct Install)
./gradlew assembleRelease
Output: android/app/build/outputs/apk/release/app-release.apk