1For windows, gradlew assembleRelease
2
3For Linux, ./gradlew assembleRelease
1After run this in cmd
2
3react-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/
4
5cd android && ./gradlew assembleDebug
6
7then you can get apk app/build/outputs/apk/debug/app-debug.apk
1Prerequisite:
2-----------------
3react-native version > 0.57
4
5How to generate one in 3 steps?
6---------------------------------
7Step 1: Go to the root of the project in the terminal and run the below command:
8---------------------------------------------------------------------------------
9react-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
10
11Step 2: Go to android directory:
12---------------------------------
13
14 cd android
15
16Step 3: Now in this android folder, run this command
17------------------------------------------------------
18 ./gradlew assembleDebug
19
20There! you'll find the apk file in the following path:
21yourProject/android/app/build/outputs/apk/debug/app-debug.apk
22
23Now you have your .apk file generated, install it on your android phone and enjoy!
24
25Thank you.
1...
2android {
3 ...
4 defaultConfig { ... }
5 signingConfigs {
6 release {
7 if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
8 storeFile file(MYAPP_RELEASE_STORE_FILE)
9 storePassword MYAPP_RELEASE_STORE_PASSWORD
10 keyAlias MYAPP_RELEASE_KEY_ALIAS
11 keyPassword MYAPP_RELEASE_KEY_PASSWORD
12 }
13 }
14 }
15 buildTypes {
16 release {
17 ...
18 signingConfig signingConfigs.release
19 }
20 }
21}
22...