Release APK generation fails in bundleReleaseJsAndAssets

Every time I try to run:, ./gradlew assembleReleaseI get the following:

FAILURE: Build failed with an exception.

Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command 'react-native''

Here is the result of stacktrace: https://gist.github.com/rpastorelle/f0a42a87656e5326a186de4e34f691a0

It works if I use sudoto run this command. However, this hides some permissions a lot, and then I get "Unable to deploy ZIP" errors in Android Studio when creating a debug version.

My global npm modules are in /usr/local/lib/node_modules, and I am the user who owns this folder. react-native-clihas not been installed using sudo.

+4
source share
3 answers

My workaround is to start ./gradlew --stop(which stops the daemon)

+5
source

Add the following code at app/build.gradlethe end of the file.

 afterEvaluate{
    android.applicationVariants.all { variant ->
        variant.ext.bundleJsAndAssets.enabled = false
     }
   }
0
source

If you ./gradlew assembleReleasedo not want to generate a new file index.android.bundlein the resources folder, put the code in the app/build.gradleone mentioned in fooobar.com/questions/16208279 / ... to disable it bundleJsAndAssets.

0
source

All Articles