How to Generate Debug APK of Android Project in React Native

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

How to Generate a Debug 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

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/

react_native_generate_debug_apk1

4. Build the debug APK using

cd android/ && ./gradlew assembleDebug

react_native_generate_debug_apk2 react_native_generate_debug_apk3

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

react_native_generate_debug_apk4

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 🙂


Related Posts

2 thoughts on “How to Generate Debug APK of Android Project in React Native”

  1. Hi,
    There are some minor changes in above command, like below

    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

    please check and update it.
    Thank you.

    Reply
    • Hi Mayur, Can you please help me to find the problem? I have tried the posted command which is working fine.
      I have seen your commented command which is having issue as param needs to be passed using double dash(–).

      With your command it is reporting
      Error: Option “–entry-file” is missing

      Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.