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

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

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

 解决方案:

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

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

flutter dio请求DioError [DioErrorType.DEFAULT]: SocketException: Insecure socket connections are disal_第1张图片

  
添加完成之后,重新打包,最好清除一下缓存

你可能感兴趣的:(Flutter,dart,flutter,网络请求,dio)