1. 无论测试环境和正式发布环境所有http换成https(强烈推荐)
2. 高版本支持http
因为Android 9.0已经禁止了非加密的网络请求,所以要想高版本还支持http请求,我们需要做以下几点
1.在项目res文件夹里创建xml文件夹,然后在xml文件夹里创建一个xxxxx.xml
2. xxx.xml代码
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
3. 在AndroidManifest.xml的application节点配置如下信息
android:networkSecurityConfig="@xml/network_security_config"