To test our React Native App in our phone, we can follow the following steps.
STEP 1 : Generate JS Bundle
npx 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
Run the above command in your project root folder. This will pack your code into a static file.
STEP 2: Build the APK
navigate to android folder using this command in terminal.
cd android
Now build a debug APK using gradle
./gradlew assembleDebug
Now you can find the APK file in the following path
android/app/build/outputs/apk/debug/app-debug.apk
Now we can install this APK in our Android phone to test our App.
Discover more from Learners Store
Subscribe to get the latest posts sent to your email.
One thought on “Steps to Build Offline APK for Real Device – React Native”