1、res->xml目录下增加network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
2、AndroidManifest.xml的application标签下加上
android:networkSecurityConfig="@xml/network_security_config"标签:xml,网页,network,webview,android,config,security From: https://www.cnblogs.com/baiyi168/p/16726011.html
android:usesCleartextTraffic="false"