react-native run-android builds an old version of the code onto device

回眸只為那壹抹淺笑 提交于 2019-12-31 21:45:47

问题


This occurs in both production and dev builds. I can connect to the dev server, reload, and the new code is built and runs on the device.

Step-by-step of what I have tried:

  1. Modify code.

  2. Re-bundle:

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

  1. ./gradlew clean

  2. react-native run-android - Builds old version

  3. react-native run-android --variant=release - Builds old version

Is there any way to completely wipe the android build and build from scratch? My gut tells me that run-android is not performing a full clean build.


回答1:


  1. Delete files inside directory android/app/src/main/assets.
  2. 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
  3. $ react-native run-android


来源:https://stackoverflow.com/questions/48019419/react-native-run-android-builds-an-old-version-of-the-code-onto-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!