'react-native run-android' is loading old bundle in android device

Viewed 5069

Recently I have formatted my machine and OS been re-installed. Since then when I run react-native run-android old bundle is being installed in my android device.But in emulator updated bundle is loading.

As per this source android OS must be Android 5 and above, But mine is Android 8(Oreo).

Even i tried to do follow these suggestions, But it seems like a work around and have to run those commands every time I update a single character of a code which is not a permanent solution.

As far as i know I must mave missed to do something after reinstalling OS(as it was quite fine before re-installing the OS).

Could any body help to make the new bundle run in device.

3 Answers

I thing your problem is look like this.

Code is not modified

open you terminal and go to project location and run

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/

Please try this method

  1. First, open your project in the terminal and run 'react-native start'
  2. Open Android studio and run the project on an emulator

If you are stuck with running the application to your device instead of an emulator

  1. Open your project in the terminal and run this, Bundle command

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

  2. Then run react-native start, then open your Android studio and run your application to your device

if you are using the git version control system so make sure you have the actual code for the new bundle I mean you are in the actual branch where your code.

try this

simply uninstall the app from the device. Go to the inside android folder then run ./gradlew clean and then cd to root folder and build again using react-native run-android.

Related