As of react-native 0.57, none of the previously provided answers will work anymore, as the directories in which gradle expects to find the bundle and the assets have changed.
Simple way without react-native bundle
The simplest way to build a debug build is without using the react-native bundle
command at all, but by simply modifying your app/build.gradle
file.
Inside the project.ext.react
map in the app/build.gradle
file, add the bundleInDebug: true
entry.
If you want it to not be a --dev
build (no warnings and minified bundle) then you should also add the devDisabledInDebug: true
entry to the same map.
With react-native bundle
If for some reason you need to or want to use the react-native bundle
command to create the bundle and then the ./gradlew assembleDebug
to create the APK with the bundle and the assets you have to make sure to put the bundle and the assets in the correct paths, where gradle can find them.
As of react-native 0.57 those paths are
android/app/build/generated/assets/react/debug/index.android.js
for the bundle
and android/app/build/generated/res/react/debug
for the assets. So the full commands for manually bundling and building the APK with the bundle and assets are:
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/generated/assets/react/debug/index.android.bundle --assets-dest ./android/app/build/res/react/debug
and then
./gradlew assembleDebug
Bundle and assets path
Note that that paths where gradle looks for the bundle and the assets might be subject to change. To find out where those paths are, look at the react.gradle
file in your node_modules/react-native
directory. The lines starting with def jsBundleDir =
and def resourcesDir =
specify the directories where gradle looks for the bundle and the assets respectively.