I'm working on a Project in ReactNative & it's working fine in debug build (When installing via react-native run-android but When I generate a release build it crashes as soon as I open it, according to logs it's unable to load script, and android/app/src/main/assets directory is empty.
To resolve this I had to run these commands:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
rm -rf ./android/app/src/main/res/drawable-*
But now the file index.android.js won't update in a release build, so I have to run the above commands every time I need a release build, what am I doing wrong?
Here are my packages.json details:
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"react": "16.8.3",
"react-native": "0.59.5"
In short: How to create or update index.android.bundle automatically when I generate a release build?