html – HTML5 Android Phonegap Web app not working offline with cache manifest-ThrowExceptions

Exception or error:

I have a simple web app built with Phonegap and Android that call external ressources (js, css, html) from server instead of storing it in Phonegap assets folder. I prefer using external ressources because my server can deliver html pages taking in charge internationalization.

This web app work fine on my android device when WIFI is on but it fail when stopping WIFI. My index.html file delivered by my server contain a valid manifest file with correct mimetype (‘text/cache-manifest’) that list every files the app need to work.

My Android Activity class is supposed to have caching enable:

    this.appView.getSettings().setAppCacheMaxSize(1024 * 1024 * 15);  

    String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();

It may worth mentionning that my app use ajax call with urls like /aaa/bbb/ to call web pages from server and I don’t know if that may be the problem (l’m not calling physical pages directly like index.html)… However, this web app work well in desktop browser (Google Chrome) when offline…

Any idea what more can I do to enable this HTML5 cache feature on my Phonegap app?

Thanks a lot

How to solve:

After playing around for a while I get it to work. Here is some points you should verify when stucked with this type of caching problem:

  • Take care about url parameters passed with GET method… I was passing parameters when navigating between pages of my app and those parameters was making my urls different from the ones in manifest file making cache to fail.
  • When testing offline mode on my phone, I was only shutting down the WIFI thinking this was enough to trigger cached version of my app but it was not… As I was testing my app published under a local network IP (like, it appear that my app was trying to reach that IP trough the 3G network that was still ON… So use airplane mode when testing offline.
  • Not sure if this one was necessary as I read it on some others threads but I renamed my manifest file to cache.manifest.



Apparently you need “to fix the Android Shell Native App to enable HTML5 caching”.

If you haven’t already, please check out:


I am developing a similar system. What I did was I created the Phonegap webpages and stored them in the www folder of my WAMP server. Then what I do is I basically super.LoadURL(“insert_ip_address_here/insert_name_of_folder_where_webpage_is_located”) in the onCreate method and this loads the phonegap application perfectly (yes all you need is just only line of code in the Android app itself). However you still have to make sure that the config.xml, manifest and all configurations needed for phonegap are properly done (for instructions on this see

Let me know if this the path you choose to pursue. I can provide extra support with things like making the ip-address (in the line super.loadurl(…)) dynamic for the local system using multi-casting, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *