Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

index.android.bundle not updating when creating release build

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?

like image 700
Zain Ul Abideen Avatar asked Oct 14 '25 23:10

Zain Ul Abideen


1 Answers

for react-native 0.70.6:

make sure you have com.android.tools.build:gradle:7.2.2 in your android/build.gradle and not com.android.tools.build:gradle:7.3.1

like image 116
Moritz Avatar answered Oct 17 '25 11:10

Moritz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!