1

While trying to run generated build apk or debugging on physical device , It is loading old bundle. and not reflecting any changes, it Happens only with physical device on same network.

Following tricks are not working for me. 1.

 Run the command in a terminal: ps ax | grep react-native
    Kill all processes and run bundle script again.

2.

 rm -rf $TMPDIR/react-*

3.

--resetCache true

4.

--reset-cache

5.

Permanent delete node_modules
npm cache clean –force
npm install
npm start -- --reset-cache
deva11
  • 881
  • 10
  • 25

4 Answers4

5

The Story Starts Here. Unable to load script from assets 'index.android.bundle'

Was getting error while loading on physical device.

So, For fixing it. Had to follow the below lines in project root folder

mkdir android/app/src/main/assets

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

react-native run-android

From second time on wards ,need to execute following code for updating the bundle before loading into physical device

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
deva11
  • 881
  • 10
  • 25
0

Try this to clean your current build.
cd android && ./gradlew clean
cd .. && react-native run-android

Also delete the current generated APK inside the outputs/apk folder inside android.

And if you are using windows, try running the terminal window as administrator.

Hisham Mubarak
  • 1,559
  • 3
  • 22
  • 28
0

try this command

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

and after that run again following command

react-native run-android
0

These are the correct steps that worked for me in order to manually build the bundle and install it on the device, been scratching my head for hours until I managed to find how to do this properly:

cd android

./gradlew clean

cd ../

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

./gradlew assembleRelease

./gradlew installRelease