在res/xml目录下创建network_config.xml文件夹
内容为
<?xml version="1.0" encoding="utf-8"?>
<!--Android9以上机型 https请求适配-->
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
在AndroidManifest.xml文件中添加network_config.xml文件的引用
android:networkSecurityConfig="@xml/network_config"