其他分享
首页 > 其他分享> > React Native Android Code Push InstallRelease构建失败

React Native Android Code Push InstallRelease构建失败

作者:互联网

我正在尝试将代码推送添加到我的react native应用中,并按照https://github.com/Microsoft/react-native-code-push中提到的所有步骤进行操作
完成之后,我的调试版本运行正常
我用 :

$./gradlew installDebug

但是发布构建失败,这由以下命令给出:

$./gradlew installRelease

这给出了以下错误:

: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服务的React Native插件

我使用以下命令生成捆绑包:

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

我的本机版本是0.18,
代码推送版本为0.16

解决方法:

原来这是在将React Native从0.15之前的版本升级到0.15以后的版本时经常遇到的问题.

react gradle任务bundleReleaseJsAndAssets似乎是罪魁祸首.

可以使用禁用它

enabled config.bundleInRelease ?: false 

在react.gradle或注释行中(尽管不能保证工作正常)

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

并使用
react-native bundle命令

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/

或基于curl的命令

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

标签:react-native,gradle,code-push,android
来源: https://codeday.me/bug/20191119/2033312.html