简体   繁体   中英

Android 9: Cleartext HTTP traffic not permitted in webview

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?

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

在此处输入图片说明

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM