android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config"
android\app\src\main\res\xml\network_security_config.xml
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> </dict> </plist>
此办法参考链接:https://www.cnblogs.com/sea-stream/p/13908198.html
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true" /> </network-security-config>
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <!-- 配置7.0抓包--start --> <debug-overrides> <trust-anchors> <!-- Trust user added CAs while debuggable only --> <certificates src="user"/> </trust-anchors> </debug-overrides> <!-- 配置7.0抓包--end --> <!-- 配置9.0明文请求--start --> <base-config cleartextTrafficPermitted="true" /> <!-- 配置9.0明文请求--end --> </network-security-config>