Reputation: 2464
I am using such command to generate an APK:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android
Is it possible to edit this command to generate release APK?
Upvotes: 2
Views: 10190
Reputation: 402
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && cd android && ./gradlew clean && ./gradlew assembleRelease
./gradlew assembleRelease
assembles all release builds (and generates release apk)
Your release build should be available under the following directory: [projectRoot]/android/app/build/outputs/apk/release/
Upvotes: 7
Reputation: 429
ORG_GRADLE_PROJECT_bundleInArRelease=true npx react-native run-android --variant Release
then you will find the APK inside ./android/app/build/apk/release/
I hope it helps you
Upvotes: 1
Reputation: 784
mkdir -p android/app/src/main/assets
&& rm -rf android/app/build
&& react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
&& cd android && ./gradlew clean assembleRelease && cd ../
I hope this will work for you…
Upvotes: 1