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
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).
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.
I have deleted android-debug.apk from platforms/android/build/outputs/apk and then ionic cordova run android. It worked with no cache.
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
Try
ionic repair
This is a full clean build of all yur packages Official Documentation: https://ionicframework.com/docs/cli/commands/repair
This might be a bug with Ionic, but to fix it usually I just ctrl+c then gulp and then re-run ionic serve.