Eyeball
Eyeball

Reputation: 3317

React Native assembleRelease does not work for version 0.59.10

When I try to make a release build in my project, I get the following error. This happens both when I use android studio and using ./gradlew assembleRelease

> Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '/<path>/ mobile/android/app/build/generated/assets/react/release/index.android.bundle.map''

It works, however, if I do the release like this:

react-native bundle --platform android --entry-file index.js --reset-cache --bundle-output android/app/src/main/assets/index.android.bundle --dev false --assets-dest android/app/src/main/res/

followed by

./gradlew assembleRelease -x bundleReleaseJsAndAssets

Since the second case works, and the first case does not work, I think that something is weird with the path that bundleReleaseJsAndAssets tries to use. It looks for a command ('command '/<path>/ mobile/android/app/build/generated/assets/react/release/index.android.bundle.map') at a location that is empty. Isn't it looking in the wrong dir?

Shouldn't bundleReleaseJsAndAssets try to use the location that I had in the second case? (--bundle-output android/app/src/main/assets/index.android.bundle)?

Upvotes: 0

Views: 1468

Answers (2)

Rishav Kumar
Rishav Kumar

Reputation: 5450

Thats probably because :

  1. Earlier there were two seperate folders index.js for each android and iOS. So it created two different bundle files like index.android.js and index.iOS.js file during compilation.

  2. Now these two files are merged and rendered using a single file known as index.js.

Your command : react-native bundle --platform android --entry-file index.js --reset-cache --bundle-output android/app/src/main/assets/index.android.bundle --dev false --assets-dest android/app/src/main/res/ is basically for index.js which works because may be there is a index.js file but no index.android.js.

To make it work please upgrade your react-native-sentry to version [email protected]. Please refer here

Upvotes: 1

Vishal Dhanotiya
Vishal Dhanotiya

Reputation: 2638

Try this command you can generate release build

react-native run-android --variant=release

Using this you don't need to make bundle manually. This command automatically create you bundle and release apk both.

Upvotes: 0

Related Questions