1、在res/xml文件夹下面新建network_security_config.xml文件
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
2、application中引用
android:networkSecurityConfig="@xml/network_security_config"