解决android webview 中打不开https页面
来源:互联网 发布:网络流行歌曲2016歌曲 编辑:程序博客网 时间:2024/06/05 16:03
当load有ssl层的https页面时,如果这个网站的安全证书在Android无法得到认证,WebView就会变成一个空白页,而并不会像PC浏览器中那样跳出一个风险提示框。因此,我们必须针对这种情况进行处理。(这个证书限于2.1版本以上的Android 系统才可以)
wv.setWebViewClient(new WebViewClient(){
@override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){
//handler.cancel(); 默认的处理方式,WebView变成空白页
//handler.process();接受证书
//handleMessage(Message msg); 其他处理
}
写到这里之后,直接运行是页面是可以打开的。但是打好签名包之后,依旧打不开!!!
一路追踪之后,发现是那个方法被混淆了
proguard:mapping.txt
xx.xx.xxx
xx.xx.xxx this$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
-dontwarn android.webkit.WebViewClient
还有一点要提到的是,如果手机添加了代理。也是打不开的
0 0
- 解决android webview 中打不开https页面
- android webview 访问https页面 SslError 处理
- android webview 访问https页面 SslError 处理
- android webview 访问https页面 SslError 处理
- Android开发使用https及Webview访问https页面
- Android中WebView加载带有ssl层的https页面
- 【Android】WebView加载https页面不能正常显示资源问题
- 【Android】WebView加载https页面不能正常显示资源问题
- Android WebView加载https页面不能正常显示资源问题
- Android 7.0系统webview 显示https页面空白处理
- 解决android webview https图片不显示问题
- Android WebView Https
- android webview https blank
- android webview 加载https
- android 解决webView页面双击出现复制剪切等
- Android WebView https请求问题。
- android webview加载https网站
- android webview加载https网页
- Fragment not attached to Activity
- Linux USB gadget解析(2)
- VS2010项目的部署与安装
- ios 中UIView bounds 和 frame 属性的区别
- 格式化数字串(增加千分位标示符)
- 解决android webview 中打不开https页面
- 【原创】C语言处理文件数据(1)
- 使用setacl修改注册表的权限
- UVa 1589 - Xiangqi
- Django学习笔记(11):视图进阶(上)
- Ubuntu14.04解决输入法问题
- PHP 文件上传
- Linux使用领域
- cleanapp 注册码