应用提交谷歌商店SSL Error Handler错误解决
解决办法:在webview重写此方法,代码如下
1 public void onReceivedSslError(WebView view,final SslErrorHandler handler, 2 SslError error) { 3 final AlertDialog.Builder builder = new AlertDialog.Builder(_mainActivity); 4 String message = "SSL Certificate error."; 5 switch (error.getPrimaryError()) { 6 case SslError.SSL_UNTRUSTED: 7 message = "The certificate authority is not trusted."; 8 break; 9 case SslError.SSL_EXPIRED: 10 message = "The certificate has expired."; 11 break; 12 case SslError.SSL_IDMISMATCH: 13 message = "The certificate Hostname mismatch."; 14 break; 15 case SslError.SSL_NOTYETVALID: 16 message = "The certificate is not yet valid."; 17 break; 18 case SslError.SSL_DATE_INVALID: 19 message = "The date of the certificate is invalid"; 20 break; 21 case SslError.SSL_INVALID: 22 default: 23 message = "A generic error occurred"; 24 break; 25 } 26 message += " Do you want to continue anyway?"; 27 28 builder.setTitle("SSL Certificate Error"); 29 builder.setMessage(message); 30 31 builder.setPositiveButton("continue", new DialogInterface.OnClickListener() { 32 @Override 33 public void onClick(DialogInterface dialog, int which) { 34 handler.proceed(); 35 } 36 }); 37 builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() { 38 @Override 39 public void onClick(DialogInterface dialog, int which) { 40 handler.cancel(); 41 } 42 }); 43 final AlertDialog dialog = builder.create(); 44 dialog.show(); 45 }