System.err:javax.net.ssl.SSLPeerUnverifiedException:即使添加了network-security-config后,主机名XXX也未得到验证

时间:2018-09-18 18:04:35

标签: android android-networking androidhttpclient android-network-security-config

我已在清单中添加了网络安全配置,但仍收到主机名未验证的错误。

<manifest ...>
   android:networkSecurityConfig="@xml/network_security_config"
</manifest>

<network-security-config>
  <domain-config>
    <domain includeSubdomains="true">XXX</domain>
    <trust-anchors>
        <certificates src="system" />
        <certificates src="user" />
        <certificates src="@raw/xxx"/> This is a .cer file
    </trust-anchors>
  </domain-config>
</network-security-config>

但是我仍然遇到以下错误。

System.err: javax.net.ssl.SSLPeerUnverifiedException: Hostname XXX not verified

0 个答案:

没有答案