jay shah
jay shah

Reputation: 993

React native android code push installRelease build fails

I am trying to add code push to my react native app, and followed all steps mentioned in https://github.com/Microsoft/react-native-code-push After doing it, my debug build works fine I use :

$ ./gradlew installDebug

but the release build fails which is given by following command :

$ ./gradlew installRelease

which gives 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 - React Native plugin for the CodePush service.

I use following command to generate the bundle :

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

my react native version is 0.18, code push version is 0.16

Upvotes: 3

Views: 1800

Answers (1)

jay shah
jay shah

Reputation: 993

Turns out this is a problem frequently encountered when upgrading in react native from pre 0.15 to post 0.15 versions.

The react gradle task bundleReleaseJsAndAssets seems to be the culprit.

one can disable it using

enabled config.bundleInRelease ?: false 

in react.gradle or comment the line (no guarantees to work properly though)

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

and manually made bundle file using 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 command

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

Upvotes: 3

Related Questions