I have this random issue with ionic build
or ionic 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
Would like to answer this question as it wasted some real valuable time for me.
I emptied the
platforms
folder and build the solution again. BTW, I am using Visual Studio for development. And I should solve the problem.Also it is quite obvious but still wanted to reiterate that platforms should not be part of source control.
Hope it helps.
Remove platform : ionic cordova platform rm android
Re add platform : ionic cordova platform add android
Step 1) ionic cordova prepare android // copy www folder specific platform
Step 2) ionic cordova build android // build apk
Step 3) ionic cordova run android // deploy latest apk in device
This might be a bug with Ionic, but to fix it usually I just ctrl+c then gulp and then re-run ionic serve.
I have deleted
android-debug.apk
fromplatforms/android/build/outputs/apk
and thenionic cordova run android
. It worked with no cache.You need to increment your app version on your config.xml (at the top of your project folder) to reflect your changes before running:
On this example, increment the attribute version to 0.0.9:
version="0.0.9"
.Then
run android
orrun ios
.I had the problem where the app would load most recent changes locally using
npm run dev
but when I tried to run on my device withcordova run android
it would load an old version. I tried all of the suggestions above and nothing worked. I finally figured out that if I did annpm run build
before I did the build with cordova to my device, it would load the new version. Hope this helps someone.