WebView握手失败 [英] webview handshake failed

查看:198
本文介绍了WebView握手失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用webview调用发帖请求(Https).在我的logcat中,我找到了

I cannot call post request (Https) using webview. In my logcat I find this

[1031/175452:ERROR:ssl_client_socket_openssl.cc(905)]握手失败;返回0,SSL错误代码5,net_error -107 ****

[1031/175452:ERROR:ssl_client_socket_openssl.cc(905)] handshake failed; returned 0, SSL error code 5, net_error -107****

在android 4.3中不起作用

It's not working in android 4.3

推荐答案

快速修复:忽略SSL证书错误.

    WebView webview = findViewById(R.id.webView_about_alc);


    webview.setWebViewClient(new WebViewClient() {

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Toast.makeText(AboutAlcActivity.this, description, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError er) {
            handler.proceed(); // Ignore SSL certificate errors
        }

    });

    webview.loadUrl(ALC_ABOUT_PAGE);

-

更好的解决方案: 修复项目的Android网络安全配置.请按照以下链接进行操作.

Better Solution: Fix the Android Network Security Configuration for your project. Follow the below link on how to do so.

https://developer.android.com/training/articles/security-config

这篇关于WebView握手失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆