How to force refresh the cached source files upon Ionic build/run?
Solution 1
What I did to solve my problem was to do re-initialize the Android platform.
ionic cordova platform remove android
then ionic cordova platform add android
goto task manager and kill java se process
Solution 2
You need to increment your app version on your config.xml (at the top of your project folder) to reflect your changes before running:
<widget id="com.yourapp.id" version="0.0.8" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"
On this example, increment the attribute version to 0.0.9: version="0.0.9"
.
Then run android
or run ios
.
Solution 3
Remove platform :
ionic cordova platform rm android
Re add platform :
ionic cordova platform add android
Step 1) copy www folder specific platform
ionic cordova prepare android
Step 2) build apk
ionic cordova build android
Step 3) deploy latest apk in device
ionic cordova run android
Solution 4
If you use cordova build, sudo cordova build <platform>
sudo cordova prepare
at your cordova project root folder.
this command reflects your changes to builds(all platforms).
Solution 5
This might be a bug with Ionic, but to fix it usually I just ctrl+c then gulp and then re-run ionic serve.
Related videos on Youtube
Rene Padillo
A Schemer | Software Engineer | Front-End Web Developer
Updated on March 24, 2022Comments
-
Rene Padillo about 2 years
I have this random issue with
ionic build
orionic run
.I've noticed that during compilation it uses the cache of my source code, therefore when making new changes it doesn't reflect upon re-compiling the app.
So my question is, how can you clear the cache for the build files? I've tried doing
ionic state reset
but still it doesn't work nor doing uninstall then re-install the app from my Android.Thanks
-
Swapnil Shende over 8 yearspossible duplicate of Is it possible to clear the view cache in Ionic?
-
Rene Padillo over 8 years@SwapnilShende I think this isn't a duplicate question, because my issue is with the Ionic build not with views.
-
InfinitePrime over 8 yearsDoes this really happen? I am not sure on this. If you can reproduce it, then open an issue on github
-
Rene Padillo over 8 years@InfinitePrime yes, I'm stuck with the build for an hour already, I've doubled check everything but it seems it's using a cached source files upon building. I'll try to investigate on how to reproduce the problem.
-
Sandy over 7 years@InfinitePrime Yes it really happens. All of a sudden it started happening in my ionic. And no matter what I do, clear browser history, restart IIS and all crazy stuff, my ionic is stuck with 2 days old changes.
-
dbinott almost 7 years2 years and this still seems like an issue because it is happening to me. What's the point of live reload if it doesn't reload? To have to reinit the platform each time is ludicrous.
-
Khurshid Ansari about 6 yearsin which platform are you facing this problem. I think you are facing problem in ios.
-
-
Ratata Tata over 7 yearsthe fast way, if you are changing something on the config.xml.
-
jonan.pineda over 6 yearsin ionic 2 use
ionic cordova platform update android
-
LavenPillay almost 6 yearsFor ionic 3 i used :
ionic cordova platform remove android
ionic cordova platform add android<br>
-
Simão Garcia over 5 yearsI've solved a similiar problem in Ionic V3 with:
cordova clean
-
Yudhistira Bayu over 5 yearsI've run remove and add platform won't work, and this is the only solution work if remove and add platform wont change anything
-
Patrick Kenny about 2 yearsThis also works for
pwa
build problems, not just Android and iOS.