欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

flutter dio请求DioError [DioErrorType.DEFAULT]: SocketException: Insecure socket connections are disal

程序员文章站 2024-01-09 22:38:22
一般发生在是安卓9的设备上,在flutter 发起网络请求中,dio报错DioError [DioErrorType.DEFAULT]: SocketException: Insecure socket connections are disallowed by platform: ****解决方案:在安卓/android/app/src/main/AndroidManifest.xml 中检查,是否存在

一般发生在是安卓9的设备上,在flutter 发起网络请求中,dio报错 

DioError [DioErrorType.DEFAULT]: SocketException: Insecure socket connections are disallowed by platform: ****

 解决方案:

在安卓/android/app/src/main/AndroidManifest.xml 中检查,是否存在

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

flutter dio请求DioError [DioErrorType.DEFAULT]: SocketException: Insecure socket connections are disal

在application XML 标签中检查是否存在 android:usesCleartextTraffic="true"

flutter dio请求DioError [DioErrorType.DEFAULT]: SocketException: Insecure socket connections are disal

  <application
        android:usesCleartextTraffic="true"   //是否存在这句
        android:name="com.ziqiangwanqiang.ClientApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="test">
添加完成之后,重新打包,最好清除一下缓存

本文地址:https://blog.csdn.net/sinat_37255207/article/details/108869967