问题
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:
Modify code.
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
./gradlew clean
react-native run-android
- Builds old versionreact-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:
- Delete files inside directory android/app/src/main/assets.
- 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
$ react-native run-android
来源:https://stackoverflow.com/questions/48019419/react-native-run-android-builds-an-old-version-of-the-code-onto-device