A browser on your PC will pop up a dialog box with certificate errors, prompting you whether to ignore the error and continue browsing. In fact, this can also be done in WebView to implement pages with problems loading certificates.
WebView webview = (WebView) findViewById();
(new WebViewClient() {
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
// *** NEVER DO THIS!!! ***
// (view, handler, error);
// let's ignore ssl error
();
}
}
Just overload the onReceivedSslError() function of WebViewClient like this and execute() in it, and you can ignore the SSL certificate error and continue loading the page.
It should be noted here that you must not call (). This is because the onReceivedSslError() function of WebViewClient contains a () (see source code, which means stop loading, so if () is called, the result is that it cannot be loaded on the first access, and it can be loaded after the second time (I don't know why), and a libc segfault may occur:
A/libc: Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1)