WebView showing ERR_CACHE_MISS on app production build

Posted by

Error:

The error message “web page not available” with the description “net::ERR_CACHE_MISS” typically occurs in Flutter apps that use the webview_flutter plugin when they are uploaded to the Play Store. This issue arises due to a security restriction in modern WebView implementations on Android.

Make sure you are using the latest version of the webview_flutter plugin. Check for updates in your pubspec.yaml file and ensure you are using the most recent version available.

  • Missing Internet Permission:
    If your AndroidManifest.xml does not include the <uses-permission android:name="android.permission.INTERNET"/>, your app cannot access web pages when installed on a real device.
  • Network Security Restrictions:
    From Android 9 (Pie) onwards, cleartext HTTP traffic is disabled by default. If your app tries to load an HTTP URL (not HTTPS), it will be blocked unless you configure network security.
  • WebView Caching Issues:
    Sometimes WebView on real devices requires additional cache or storage permissions, especially if the website tries to use login/session/cookies aggressively.

Solution :

Add Internet Permission

Edit your android/app/src/main/AndroidManifest.xml and add this line inside the <manifest> tag but outside <application>:

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

2. Check URL Protocol

Make sure your URL uses HTTPS (not HTTP). For HTTP, you’ll need to allow cleartext traffic through a network security config in AndroidManifest.xml:

xml<application
    ...
    android:usesCleartextTraffic="true">
    ...
</application>

But HTTPS is always preferred for security.

Leave a Reply

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

0
Would love your thoughts, please comment.x
()
x