Android webview访问HTTPS web page如

2017-07-17  本文已影响0人  WayOfAndroid

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

上一篇 下一篇

猜你喜欢

热点阅读