React native run-android do not updating modified code

后端 未结 21 3110
故里飘歌
故里飘歌 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:31

    You are probably updating the wrong file and not calling it in the AppRegistry class.

    Check (or post) your full index.android.js and make sure that the file that it is invoking and importing is the one you are actually modifying.

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

    This comment on github fixed my problem.

    @neonsec Cool, it do works !
    
    and I find a reason why this happened
    
    https://github.com/facebook/watchman/blob/4b98623e8fde17588f27494f3ae8f084b9b227d3/QueryableView.cpp#L48
    
    it looks like when a .git/index.lock or a .hg/wlock file exist, watchman will do nothing
    

    Solution: DELETE .git/index.lock file

    ## root app dir
    rm -f .git/index.lock
    

    otherlink: https://github.com/facebook/watchman/blob/4b98623e8fde17588f27494f3ae8f084b9b227d3/QueryableView.cpp#L48

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

    If you are using index.android.js then follow the following steps:

    Delete index.android.bundle within android/app/src/main/assets and then -

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

    2. cd ./android

    3. ./gradlew assembleRelease -x bundleReleaseJsAndAssets

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

    SOLUTION

    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
    

    OUTPUT will be :

    `c:\Users\lenger\Desktop\webrowser>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
    Scanning folders for symlinks in c:\Users\lenger\Desktop\webrowser\node_modules (43ms)
    Scanning folders for symlinks in c:\Users\lenger\Desktop\webrowser\node_modules (38ms)
    Loading dependency graph, done.
    bundle: start
    bundle: finish
    bundle: Writing bundle output to: android/app/src/main/assets/index.android.bundle
    bundle: Done writing bundle output
    

    and after

    Run react-native run-android again, you will find your modification work.

    https://lengerrong.blogspot.am/2018/01/react-native-run-android-do-not.html

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

    For me the problem was that I had removed internet permissions from my AndroidManifest.xml (since it technically wasn't needed). React Native uses that permission to connect your app to the development machine (and enable live-debugging).

    <uses-permission android:name="android.permission.INTERNET" />
    
    0 讨论(0)
  • 2020-12-13 06:39

    This worked for me. Step 1)

    rm -rf /usr/local/var/run/watchman && brew uninstall watchman && brew install watchman
    

    Step2)

    react-native start
    
    0 讨论(0)
提交回复
热议问题