React native run-android do not updating modified code

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

    After trying @SmoggeR_js answer and still if you have the same problem try following (Assuming that you have created keys and already signed the apk)

    1. Delete build inside android/app folder
    2. Delete build inside android folder
    3. run rm -rf $HOME/.gradle/caches/ to delete cache
    4. Open build.gradle --> android/app/build.gradle
    5. comment out this line apply from: "../../node_modules/react-native/react.gradle"
    6. Delete index.android.bundle file from assets folder ( android/app/src/main/assets/index.android.bundle)
    7. run following command 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
    8. react-native run-android --variant=release (you have to generate signed keys and all the keys should updated in the gradle file ref (https://s-pace.github.io/react-native/docs/signed-apk-android.html)

提交回复
热议问题