我正在尝试将代码推送添加到我的react原生应用程序中,并遵循了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'.用于CodePush服务的GitHub Microsoft/ React - Native -code-push react-native-code-push -React Native插件。
我使用以下命令来生成包:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"我的react原生版本是0.18,代码推送版本是0.16
发布于 2016-02-06 00:57:02
事实证明,这是在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"https://stackoverflow.com/questions/35226213
复制相似问题