React-Native building an apk for debug to run independent of Metro server

Build your Android and iOS Apps compatible to 4 Android Versions (for 93% users) Users and 2 iOS Versions (for 92% users)
January 16, 2018

Here are the steps to build an apk for a React-Native application

Step 1: Go to project directory and run this command in terminal. This will bundle the assets to be able to build the app to run independent of the Metro server

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/

Step 2: Go to android directory

cd android/

Step 3: In android path run this command

./gradlew assembleDebug

Step 4 : Go to this folder and check the apk file

your_project-> android-> app-> build-> outputs-> apk-> debug-> app-debug.apk

Now apk file generated , you can install the app-debug.apk in your android mobile

Leave a Reply

Your email address will not be published.