11

When using webview in flutter i am getting this message. here is the code

import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';

class Webview extends StatelessWidget {
  String url;
  Webview({this.url});
  @override
  Widget build(BuildContext context) {
    return WebviewScaffold(
      url: url,
      withJavascript: true,
      withLocalStorage: true,
      appCacheEnabled: false,
      withZoom: true,
      ignoreSSLErrors: true,
    );
  }
}

These are the permissions in debug/androidManifest.xml

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

I tried using webview_flutter and flutter_webview_plugin plugin both have the same issue.

The app works fine in simulators but when used on real devices I get thrown this error. Please help and Thank you for reading.

Rakesh
  • 111
  • 1
  • 3
  • 8

1 Answers1

42

WebView in Debug is working because you have Internet permission in debug/androidManifest.xml

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

add the same in main/androidManifest.xml

Chase Vis
  • 435
  • 5
  • 9