lecham
lecham

Reputation: 2464

React Native: generate release APK using npm command

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

Answers (3)

user3764429
user3764429

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

MShokry
MShokry

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

Tanveerbyn
Tanveerbyn

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

Related Questions