4

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 3

9

I think 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/
Sign up to request clarification or add additional context in comments.

7 Comments

After running this command, If I run `react-native run-android' everything is fine. But may I know what's happening when I run above command?
This command create a file in android assets and the code compile from that file. If we modify our code and not execute this command then code still execute from that file created before and we are unable to get latest modified changes.
Running this command creating some new files which i cannot push to my git repo. So every time I push the code i have to delete these files and then have to run the command. Isn't there any permanent solution for this issue with out running the command?
We have to run command but if you don't want to push that files in your git then you add them to git ignore.
Ok I will do so, But I am really surprised to see that why it is not working as usual after re-installing the OS. Can you guess any reason?
|
0

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.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.