博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
解决Google Play审核中的WebViewClient.onReceivedSslError问题
阅读量:4594 次
发布时间:2019-06-09

本文共 3063 字,大约阅读时间需要 10 分钟。

Google Play应用市场提交应用审核,出现因WebViewClient.onReceivedSslError问题导致拒绝通过。

Google Paly给出的详情地址:

 

 

处理起来其实也相对简单,主要是针对用到WebViewClient对象重写onReceivedSslError()方法。

如:

@Overridepublic void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {    AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());    builder.setMessage("SSL认证失败,是否继续访问?");    builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {        @Override        public void onClick(DialogInterface dialog, int which) { handler.proceed(); } }); builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); // 上报SslError信息到服务端,以便排查具体问题 CornLog.e(view, handler, error); ... } 复制代码

项目主工程通过直接搜索WebViewClient,对应重写onReceivedSslError()方法,相对都很简单,主要问题在,针对项目中直接引入的jar包和通过gradle dependencies引入的外部库,需要统一核查。

通过gradle dependencies引入的外部库,通常是以aar形式存在,项目构建过程中,最终都会将aar中的有效部分,如jar文件,拷贝到当前项目构建目录,参与整体构建过程。

于是,构建完成后,可以通过命令直接查找项目目录下的jar文件,将其中的WebViewClient相关类都找到,并逐一排查,对于涉及到的自己的独立jar文件或gradle dependencies引入的外部库,可以自行修改,对于外部第三方(如QQ,微博等相关的登录分享库等)的库,可以考虑是否需要升级新的版本(新的版本很可能已经解决,因为第三方也会收到同样的问题或有人已经反馈过),或者反馈给第三方等方式解决。

使用搜索命令:

find . -name '*.jar' -exec zipgrep -i WebViewClient {} \;
输出结果为:

...com/corn/biz/activity/BbsDetailActivity$LoanWebViewClient.class:Binary file (standard input) matchescom/corn/biz/activity/BbsDetailActivity.class:Binary file (standard input) matchescom/sina/weibo/sdk/web/client/AuthWebViewClient.class:Binary file (standard input) matchescom/sina/weibo/sdk/web/client/BaseWebViewClient.class:Binary file (standard input) matchescom/sina/weibo/sdk/web/client/DefaultWebViewClient.class:Binary file (standard input) matchescom/sina/weibo/sdk/web/client/ShareWebViewClient.class:Binary file (standard input) matchescom/sina/weibo/sdk/web/WeiboSdkWebActivity$1.class:Binary file (standard input) matchescom/sina/weibo/sdk/web/WeiboSdkWebActivity$2.class:Binary file (standard input) matchescom/sina/weibo/sdk/web/WeiboSdkWebActivity.class:Binary file (standard input) matchessdk/meizu/auth/ui/AuthActivity$1.class:Binary file (standard input) matchessdk/meizu/auth/ui/AuthActivity.class:Binary file (standard input) matchescom/cmic/sso/sdk/widget/a$1.class:Binary file (standard input) matches com/cmic/sso/sdk/widget/a.class:Binary file (standard input) matches com/tencent/connect/auth/a$a.class:Binary file (standard input) matches com/tencent/connect/auth/a.class:Binary file (standard input) matches com/tencent/open/c$a.class:Binary file (standard input) matches com/tencent/open/c.class:Binary file (standard input) matches com/tencent/open/TDialog$FbWebViewClient.class:Binary file (standard input) matches com/tencent/open/TDialog.class:Binary file (standard input) matches ... 复制代码

逐一排查每项涉及到的外部文件,并确认是否已经处理好onReceivedSslError()方法。

作者:HappyCorn
链接:https://juejin.im/post/5cb1416a6fb9a0685727dd92
来源:掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

转载于:https://www.cnblogs.com/lwbqqyumidi/p/10700677.html

你可能感兴趣的文章
windows下 JDK安装
查看>>
JS学习之闭包的理解
查看>>
Java学习之内部类
查看>>
Oracle内部视图:x$ktfbfe
查看>>
/etc/fstab文件中的一些参数
查看>>
雅可比矩阵与雅可比行列式
查看>>
Programming With Objective-C---- Introduction ---- Objective-C 学习(一)
查看>>
正则表达式语法大全
查看>>
DateUtils
查看>>
pb开发的客户端,使用oracle 9i客户端 提示oci.dll could not be loaded
查看>>
wordpress调用指定post type文章怎么操作
查看>>
magento开发手册之目录结构
查看>>
换个红圈1微信头像恶搞一下好友
查看>>
javascript学习_廖大_20170218
查看>>
bzoj2038: [2009国家集训队]小Z的袜子(hose) 莫队
查看>>
火车头采集基本使用
查看>>
MYSQL中插入数据以及修改数据的部分方法
查看>>
unity中遍历动画得到动画名字和动画数量
查看>>
调整WebLogic的时间
查看>>
Linux学习笔记总结--配置iptables防火墙
查看>>