<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config>
这个配置是允许我们以明文的方式在网络上传输数据,而HTTP使用的就是明文传输方式。然后还需在清单文件中的application标签加入如下
android:networkSecurityConfig="@xml/network_config"
android 添加网络权限还是无法访问网络 Android 9.0以上系统使用HTTP限制
原文:https://www.cnblogs.com/zhangxuetao/p/13820090.html