React native run-android do not updating modified code

后端 未结 21 3108
故里飘歌
故里飘歌 2020-12-13 06:02

I am using React native 0.52.0 and react-native-cli 2.0.1 on my Windows PC for android development. Despite all the changes i have made. When I run react-native run-an

相关标签:
21条回答
  • 2020-12-13 06:27

    Try this

    cd .git (in your react-native folder)
    rm index.lock
    

    and restart metro bundler i.e. react-native start

    wallaa!!...

    0 讨论(0)
  • 2020-12-13 06:27

    In my case when I disable debugging then it updates. So this is my solution.

    in Chrome dev tools > Network > Disable cache Hope that shell work for you

    0 讨论(0)
  • 2020-12-13 06:29

    Open package.json file and update this code.

    "scripts": {
    "android": "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",
    "ios": "react-native run-ios"
    },
    

    Assuming that you are in the right folder, try to do this:

    Run this command only it will automatically both commands.

    npm run android

    0 讨论(0)
  • 2020-12-13 06:29

    For CodePush users

    I was having this same problem but it didn't update my code just on a production build, it works fine in development.

    My problem was CodePush, it was updating my app because it had the same version than the last CodePush release target version and it was a mandatory update (I didn't change the version target because it was just for testing purpose), then, I commented the CodePush code on my App.js and it works perfectly.

    0 讨论(0)
  • 2020-12-13 06:29

    Open your Android Studio -> "Tools" menu -> "AVD manager" and right click the emulator you are using, choose "Wipe Data" then "Cold Boot Now" should solve the problem.

    0 讨论(0)
  • 2020-12-13 06:30

    Run the script:

    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
    

    After that, just do:

    $ gradlew clean
    $ react-native link
    
    0 讨论(0)
提交回复
热议问题