We always want to test our app before creating a signed APK file or ABD file and publishing it to the Google Play Store. Generating a debug APK file not only helps us to test the app ourselves but also let us to share it among other users.
Let’s check how to generate debug APK file in react native.
First of all, create a new folder named assets at YourProject/android/app/src/main location. Create a file named index.android.bundle inside the assets folder.
Open your terminal from the project location. Execute the following command so that the generated file will be independent of the development server.
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
Navigate to the android folder using the following command.
Now execute the following command to create debug APK of your project.
The APK file will be generated in YourProject/android/app/build/outputs/apk/debug location.
This react native solution to generate debug APK without the development server is tested with the react native version 0.63.4. The steps may be different for very old versions of react native.