1
votes

I bundled my latest release:

cd C:\s\ReactNative\MyRNProject\android gradlew :app:bundleRelease

After bundleRelease completed, I validated that the following file existed on my filesystem:

C:\s\ReactNative\MyRNProject\android\app\build\generated\assets\react\release\index.android.bundle

Then I executed the following command to test the release bundle before deployment:

react-native run-android --variant=release

However, this command failed with the following error:

error ENOENT: no such file or directory, open 'C:\s\ReactNative\MyRNProject\android\app\build\generated\assets\react\release\index.android.bundle'

So it appears that some process within the "react-native run-android --variant=release" command deleted the index.android.bundle file generated by bundleRelease and then another subsequent process within the "react-native run-android --variant=release" command failed because index.android.bundle no longer existed. Any idea what the root cause of this error might be or how to avoid?

1
Try running this command before you creater a release "react-native bundle --platform android --dev false --entry-file ./index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --sourcemap-output ./android/app/src/main/assets/index.android.map --assets-dest ./android/app/src/main/res/" - Nishant Nair

1 Answers

1
votes

Clean your project after working wall

cd android 
gradlew clean

Or

react-native run-android --variant=release