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