How to generate debug apk file from react-native
What is Apk:
- Android package kit (Apk) is the package file format used by the Android operating system for distribution and installation of mobile apps and middleware.
- Apk files are compressed all format files.
- Apk file extension file_name.apk
What is Debug Apk:
- An Android app will execute in debug mode in the development environment
- The debug apk must be enabled the debug logging, StrictMode and the debugging options.
- The debug apk not ready for the app stores.
Build apk (React version ≤ 0.57 version ) :
Less than 0.58 react-native version have this folder structures in android folder
your_project->android->app->build->intermediates->assets->debug
If used less than 0.58.0 version follow this steps.
Step 1: Go to project directory and run this command in terminal
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/ assets/debug/ index.android.bundle --assets-dest ./android/app/build/ intermediates /res/ merged/debug
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
Build apk ( React version ≥ 0.58 ) :
If used greater than 0.58 version follow this steps.
Step 1: If don’t have assets folder in android. you can create assets folders otherwise skip this step.
Follow this PATH,
your_project-> android-> app-> src-> main-> assets
Step 2: Go to project directory and run this command in terminal
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 3: Go to android directory
cd android/
Step 4: In android path run this command
./gradlew assembleDebug
Step 5: 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
Thank you