How to build android apk from my react-native project? This command "react-native run-android" create app-debug.apk on folder android\app\build\outputs\apk\ But when I installed it on my phone, I got an error "Unable to download JS bundle". When I started on emulator first time I use command to fix this problem:
react-native start curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
To manually create the bundle for a debug build:
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res
To build the APK's after bundling
cd android
./gradlew assembleDebug
./gradlew assembleRelease
You can download the Android Studio setup from this link : Android Studio Setup Link
An easier way would be if you have some Android Studio usage + "Android" Past Experience,
Even if you don't have any experience of Android Studio, I have given a step by step workaround for making a build, Also mentioned above is the Android Studio Setup Link:
Now wait for few minutes before the Android Studio completes its process of making an Android APK of your app.
Once Done , You can find your React Native App's Android APK file in the : "YOURPROJECT/android/app/debug" folder, or in case of Release Build in the: "YOURPROJECT/android/app/release" folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With