美文网首页
Android webview访问HTTPS web page如

Android webview访问HTTPS web page如

作者: WayOfAndroid | 来源:发表于2017-07-17 21:02 被阅读0次

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

myWebView.loadUrl("https://cap.cityu.edu.hk/studentlan/");

//添加下面2行代码来忽略SSL验证

WebViewClient  mWebviewclient =newWebViewClient(){

publicvoidonReceivedSslError(WebView view, SslErrorHandler handler, SslError error){

handler.proceed();

}

};

myWebView.setWebViewClient(mWebviewclient);

proguard:mapping.txt

xx.xx.xxx

xx.xx.xxxthis$0 -> a

void onReceivedSslError(android.webkit.WebView,android.webkit.SslErrorHandler,android.net.http.SslError) -> onReceivedSslError

所以还要必要在混淆文件proguard.cfg中,加入以下:

-keep public class android.net.http.SslError

-dontwarn android.webkit.WebView

-dontwarn android.net.http.SslError

-dontwarnAndroid.webkit.WebViewClient

相关文章

网友评论

      本文标题:Android webview访问HTTPS web page如

      本文链接:https://www.haomeiwen.com/subject/zqbghxtx.html