20

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.

Biiiiiird
  • 384
  • 1
  • 3
  • 17
  • Did you try resetting the bundler cache? – Kraylog Dec 29 '17 at 08:09
  • If you're referring to `react-native start --reset-cache`, I tried that and it did not work. If you're referring to something else, please share. I did however find a solution, but it's probably overkill: I deleted my android folder, ran `react-native upgrade`, re-bundled and ran `react-native run-android`. I am sure there is a better fix than this. – Biiiiiird Dec 29 '17 at 08:14
  • you can delete `android/app/src/main/assets` folder before re-bundle – Sarantis Tofas Dec 29 '17 at 11:43
  • @Akis The problem has somehow come back again and clearing the assets folder, rebundling deletes all my fonts + images from the newly built apk. Is there another step that I am missing? Thanks. – Biiiiiird Dec 29 '17 at 18:25
  • @Biiiiiird - were you manage to find the issue? I am stuck on exact same problem. – Ravi Maniyar Aug 29 '18 at 07:29

2 Answers2

42
  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
zeeshan090
  • 81
  • 5
Gamma Ko
  • 442
  • 6
  • 10
0

Maybe that's not exactly what you have faced. But I was creating a staging buildType in my react native project too, the build was fine (after dealing with some problems), but for some reason it was loading an old version of the app too.

After changing the buildType from staging to releaseStaging, it started to build as expected.

I hope this answer helps anyone that might land in this page just like I did.

I've answered in another topic too with more specific instructions.

leonardomdr
  • 169
  • 6