HTTP FAILED: java.net.UnknownServiceException: CLEARTEXT communication to 172.29.1.233 not permitted by network security policy
Q:高版本Android默认禁止Http请求,放开方式:
①在res/xml文件夹下创建network_security_config.xml
文件,内容如下:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
②在AndroidManifest.xml
的application
节点添加如下内容:
android:networkSecurityConfig="@xml/network_security_config"