在res下新建xml文件夹,并创建network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
在配置清单文件application中加上
android:networkSecurityConfig="@xml/network_security_config"