user1724365
user1724365

Reputation: 97

phonegap not updating JS file?

I have compiled an app on PhoneGap multiple times(same app), and never had a problem until this afternoon. It seems PhoneGap will not update the js file (app only consists of index.html and mobile.js). If I make changes to the html file and re-build, it shows in the newest APK, but when I update the JS file(even blanked it out as a test), the APK file still has the old JS in it. Am I doing something wrong? And if so what?

Upvotes: 1

Views: 2708

Answers (1)

Dilberted
Dilberted

Reputation: 1172

The html ways of disabling the cache are

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

and add the version number as the query string when loading the js file.

<script src="mobile.js?version=1"></script>

If these don't work then try disabling the cache of the webview. In the main activity, inside the onCreate method, add either of the lines below.

 WebView webview = new WebView(this);
 webview.getSettings().setCacheMode(2);

or

super.appView.getSettings().setAppCacheEnabled(false);

Upvotes: 1

Related Questions