Charles - SSLHandshake: Received fatal alert: certificate_unknown
如果你在用charles抓包时出现了这个错,那么你可以试试这个方法,亲测android有效!
错误:
Failure SSLHandshake: Received fatal alert: certificate_unknown
解决办法:
1. 手机安装charles代理证书
charles: Help -> SSL Proxying -> Install Charles Root Cetificate on a Mobile Device 跟着它的步骤在手机上完成证书的安装
2. AndroidManifest.xml
<application android:networkSecurityConfig="@xml/network_security_config" ... </application>
3. 创建该文件network_security_config.xml: app/res/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <domain includeSubdomains="true">sit.sc.com</domain> <trust-anchors> <certificates src="user" /> </trust-anchors> </domain-config> </network-security-config>
4. 重新运行你的app试试,应该就可以啦!