I am using the webview_flutter plugin to load a page hosted on localhost(server created with dart, on the phone) but I get net::ERR_CLEARTEXT_NOT_PERMITTED and I can't make the server HTTPS.

I've implemented all the solutions here but none of these work:

  • adding a network_security_config.xml file
  • adding the android:usesCleartextTraffic option

Is there any other solution to this?


Solution 1: duanduan

I'm an android developer,let me tell you.

Open the android manifest file(both debug and release),and add

android:usesCleartextTraffic="true"

to the application tag

<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="..."
    android:icon="@mipmap/ic_launcher"
    android:usesCleartextTraffic="true">

release file path android/app/src/main/AndroidManifest.xml debug file path android/app/src/debug/AndroidManifest.xml

enter image description here

enter image description here