React native Android code push installrelease build failed

I'm trying to add code push to my react native app and follow https://github.com/Microsoft/react-native-code-push After all the steps mentioned in are completed, my debugging version runs normally. I use:

$./gradlew installDebug

However, the publish build failed, which is given by the following command:

$./gradlew installRelease

This gives the following error:

:app:generateReleaseResources
:app:mergeReleaseResources
:app:bundleReleaseJsAndAssets

    FAILURE: Build Failed with an exception.

    * What went wrong:
    Could not list contents of '/Users/jayshah/Documents/testdir/ExampleApp/node_modules/.bin/_mocha'.

GitHub Microsoft / react native code push react native code push codepush service

I use the following command to generate bundles:

curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

My native version is 0.18 and the code push version is 0.16

resolvent:

It turns out that this is a common problem when upgrading react native from a version before 0.15 to a version after 0.15

The react gradle task bundlereleasejsandassets seems to be the culprit

You can disable it using

enabled config.bundleInRelease ?: false 

In react.gradle or comment line (although not guaranteed to work)

inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)

And use the react native bundle command

react-native bundle --platform android --dev false --entry-file index.android.js \
  --bundle-output android/app/src/main/assets/index.android.bundle \
  --assets-dest android/app/src/main/res/

Or curl based commands

curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>