2016-02-05 52 views
3

我试图代码推送添加到我的反应本机应用程序,并遵循https://github.com/Microsoft/react-native-code-push 提到的所有步骤,这样做后,我的调试版本正常工作 我用:阵营Android原生代码推installRelease构建失败

$ ./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-React Native用于CodePush服务的插件。

我用下面的命令来生成包:

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

我的反应原生版本是0.18, 码推的版本是0.16

回答

3

原来,这是升级的反应本土时经常遇到的一个问题从0.15前到0.15后版本。

反应gradle任务bundleReleaseJsAndAssets似乎是罪魁祸首。

一个可使用

enabled config.bundleInRelease ?: false 
在react.gradle

禁用或注释线(无担保虽然正常工作)

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

和手动进行使用 反应天然束束文件命令

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 "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"