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, therefor
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.
To complement the solution by @Renesaensz, in ionic 4.5.0 (or greater version) add cordova to the commands:
then ionic
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 with cordova 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 an npm run build before I did the build with cordova to my device, it would load the new version. Hope this helps someone.
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