If you want to build a debug APK with React Native that does not require signing and that will work without the dev servers then, the istructions you’ll find searching the net will be a little outdated.
Many articles point out to use the react CLI “bundle” command to do that and then running manually gradlew inside the android directory.
However i found this approach not working.
The correct way, a little undocumented, is to edit android/app/src/build.gradle to add a new build “variant”.
The process is simple:
- add to the array “
project.ext.react” the following two variables:
- add to the “buildTypes” after the “release” subsection the new section:
If you did it correctly then just run:
react-native run-android --variant=beta
to sucessfully build and install the new APK indipendent from the dev server.
If you did it correctly, when running the application, you should not be able to access the dev menu.
Building an offline APK for React Native,