1.在res下创建一个xml文件夹,然后创建一个network_security_config.xml文件
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
2.在AndroidMainfest.xml文件标签中引用下
android:networkSecurityConfig="@xml/network_security_config"