Android 7引入了对证书处理方式的一些更改(http://android-developers.blogspot.com/2016/07/changes-to-trusted-certificate.html),不知怎的,我不能让我的Charles代理工作了.
我的network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<debug-overrides>
<trust-anchors>
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
Run Code Online (Sandbox Code Playgroud)
我正在调试模式下运行.但不管怎样,我明白了javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found..
不用说,我确实安装了pfx证书Settings -> Security -> Install from storage.证书显示在User Credentials但不在Trusted credentials -> User.在我的棒棒糖设备上,证书列在那里.
我正在使用okhttp3作为HTTP库.
知道我做错了什么吗?