How to force refresh the cached source files upon

2019-02-04 02:05发布

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

8条回答
Lonely孤独者°
2楼-- · 2019-02-04 02:20

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.

查看更多
在下西门庆
3楼-- · 2019-02-04 02:22

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

查看更多
再贱就再见
4楼-- · 2019-02-04 02:31

This might be a bug with Ionic, but to fix it usually I just ctrl+c then gulp and then re-run ionic serve.

查看更多
唯我独甜
5楼-- · 2019-02-04 02:37

I have deleted android-debug.apk from platforms/android/build/outputs/apk and then ionic cordova run android. It worked with no cache.

查看更多
Bombasti
6楼-- · 2019-02-04 02:40

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.

查看更多
男人必须洒脱
7楼-- · 2019-02-04 02:40

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.

查看更多
登录 后发表回答