Debug APK of Android App
Here is an example to generate debug APK of the Android project in React Native. If you are a developer then you need the debug APK to show the development to the client. Generating a debug app in React Native is a very easy and 2 step process. Let’s see how can we do that.
For the Signed APK you can visit How to Generate Signed Android APK of React Native App
Debug vs Signed APK
Before moving to the process of debug APK generation let’s see the difference between debug APK and signed APK
Major differences are the debug flag and the signing keys:
- For debug builds the apk will be signed with the default debug signing keys with debug flag enabled.
- For release keys you will have to explicitly specify the keys to sign with and the debug flag will be turned off so that it cannot be debugged.
- Proguard can be turned on for release builds. (also for debug builds but not advised). This step needs to be done explicitly and is false by default.
How to Generate APK?
To generate a debug APK in React Native we need to first bundle our app and then need to build the debug app. But before these two steps, we need to create an index.android
for once. Once you create the file then you don’t need to create it again.
1. Create an assets
directory using (One Time Step)
mkdir ./android/app/src/main/assets/
2. create a blank file with the name index.android
(One Time Step)
touch ./android/app/src/main/assets/index.android
3. bundle the app using
npx react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android --assets-dest ./android/app/src/main/res/
4. Build the debug APK using
cd android/ && ./gradlew assembleDebug
Once you see Build Success in the log you can find the app in YourProject/android/app/build/outputs/apk/debug/
with the name app-debug.apk
This is how to generate debug APK of the Android project in React Native. #1 and#2 is for the one time only, If you have generated the APK for one time then you just need to run #3 and #4.
If you are still facing the problem or you have anything to share please comment below or contact us here.
Hope you liked it 🙂
Hi, firebase notification lesson please 🙂
Here it is: Send Notification to React Native App using Firebase Cloud Messaging
I got it, but when I install the apk in android phone, it is saying please connect to the metro server or bundle is not packed correctly
Please delete previous debug.apk and then try