Google针对下一代 Android 系统(Android P) 的应用程序限制了非加密的流量请求,
也就是说http请求被限制,只能使用https请求。
解决的办法:
1.在res文件夹下创建一个xml文件夹,然后创建一个network_config.xml文件

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
2.在AndroidManifest.xml文件下的application标签增加以下属性:

android:networkSecurityConfig="@xml/network_config"
网友评论