df qin df qin - 10 months ago 62
Android Question

how to run "react-native bundle xxx" in build.gradle

In React Native android, if I want generate a apk, firstly I must to run "react-native bundle xxx" to generate index.android.bundle and copy to "assets", is there a way I can do this in gradle?
I write "react-native bundle xxx" in updatejs.sh, I can run it by "sh updatejs.sh" in terminal and it works fine, but when I call it in gradle like:

commandLine 'sh', 'updatejs.sh'

it will show error : "updatejs.sh: line 11: react-native: command not found", anyone know how to resolve the problem?

Answer Source

If you want to generate apk, check in official documentation Generating Signed APK.