Android 4.4 giving ERR_CACHE_MISS error in onReceivedError for WebView back

This error actually stems from outside of your application in most cases (occasionally it’s just a missing INTERNET permission, but that doesn’t sound like the case here).

I was typing out an explanation, but found a much more straightforward example that doubles as an explanation in this answer to another question. Here’s the relevant bits, re-hashed a little:

  1. Joe fills in an order form with his credit card information
  2. The server processes that information and returns a confirmation/receipt page that’s marked with no-cache in the header, meaning it will always be requested from the server.
  3. Joe goes to another page.
  4. Joe clicks back because he wants to double check something, taking him to the confirmation page.

The problem arises from that last step. The confirmation page was marked with no-cache, so it has to be requested from the server again. But to show the same page correctly, the same data that was passed the first time needs to get sent again.

This results in Joe getting billed twice, since a new request is being made with the same information as last time. Joe will not be a happy camper when he finds two charges on his account and an extra pair of tents on his doorstep.

It seems this situation was common enough that it is now a standard error across most browsers, and apparently, newer versions of Android. The error actually originates from Chromium, which is why you’ll see the same error in Google Chrome, and why you only see it in 4.4 (which introduced a new version of the WebView based on Chromium).

In fact, you have actually probably seen it before, it’s the message that shows up in most browsers warning you with something along the lines of “To refresh this page, the browser will have to resend data…yada yada yada”.

This is Android 4.4’s way warning you of what’s going on. How to fix it really depends on what you’re connecting to, but if you search for this situation, you’ll find that it’s fairly common, and has fixes. The exact trigger of the error is actually when the request can’t be serviced from cache (in this case, no-cache is causing that).

Depending on the nature of the request, maybe no-cache isn’t actually needed.

But from your application’s perspective, the main problem is, onReceiveError is a sort of “last resort” for the WebView. Errors you get there have propagated from underlying system. And once you end up there, you can’t continue the page load as it stands. So you don’t have a chance to allow that resend, and you can’t give the user that option, unlike, say Google Chrome does.

I ran into the same issue because in my manifest folder I had the Internet permission capitalized:

I had (error)

<uses-permission android:name="ANDROID.PERMISSION.INTERNET"/>

Should have (no error)

<uses-permission android:name="android.permission.INTERNET"/>


if (Build.VERSION.SDK_INT >= 19) {

It will fix ERR_CACHE_MISS in the WebView.
Maybe you will need to change it to SDK_INT == 19 after some Lollipop WebView updates, but it works for now.

Leave a Comment