2016-02-05 50 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"