Android报错分析: java.io.IOException: Cleartext HTTP traffic
W/System.err: java.io.IOException: Cleartext HTTP traffic to … not permitted:在android 9.0开始系统是默认禁止未加密的请求访问网络的,所以我们的http请求被驳回了。解决办法:1.在Manifest文件中添加android:usesCleartextTraffic="true"。允许使用明文传输,也就是说允许系统
·
W/System.err: java.io.IOException: Cleartext HTTP traffic to … not permitted:
在android 9.0开始系统是默认禁止未加密的请求访问网络的,所以我们的http请求被驳回了。
解决办法:
1.在Manifest文件中添加android:usesCleartextTraffic="true"
。允许使用明文传输,也就是说允许系统发送未加密请求访问网络,代码如下:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WeatherForecast"
android:usesCleartextTraffic="true">
好了,今天的内容和总结就到这了,欢迎大家在评论区进行补充和纠正
更多推荐
所有评论(0)