The certificate for this server is invalid. You might be connecting to a server that is pretending..

最近在做一个Webview加载H5页面的需求,页面空白,报错:The certificate for this server is invalid. You might be connecting to a server that is pretending to be “xxxxxxxxx.com” which could put your confidential information at risk.

产生这个错误一般会有两个原因:
1,网址没有CA签名证书,Ssl证书校验失败
2,客户端连接第三方代理,证书没有安装成功,服务请求显示

解决方案:
1,忽略SslError,继续代码执行

  @Override
            public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
                handler.proceed();   
                super.onReceivedSslError(view, handler, error);
            }

2,客户端安装并信任第三方代理证书,比如Charles

你可能感兴趣的:(Android,https,ssl,webview)