【问题标题】:Google Play app rejected - SSL Error HandlerGoogle Play 应用被拒绝 - SSL 错误处理程序
【发布时间】:2018-02-21 14:32:20
【问题描述】:

以下是我从 Google Play 收到的消息。

读完消息后,我看看Google Help Center article。对于我的想法,这应该与WebViewClient 的类及其一些方法有关,例如onReceivedSslErrorSslErrorHandler.proceed()SslErrorHandler.cancel()。然后在我的项目中,我尝试搜索一些关键字,如@9​​87654328@、SslErrorHandleronReceivedSslError。我也得到了Nothing to show的结果。

有解决此问题的建议吗?

【问题讨论】:

  • 您可能正在使用存在此问题的库。您应对 APK 附带的所有内容负责。
  • 确保您使用的是作为依赖项的任何库的最新版本。使用 Android Studio 中的 APK 分析器查看是否有东西引用了这些方法,而不是搜索源代码,以防问题来自库。
  • @CommonsWare 我正在使用 APK 分析器。有什么快速搜索这些方法的方法吗?
  • 进入classes.dex,然后深入到android.webkit等等。
  • 你已经很久没有问这个问题了。你找到解决办法了吗?

标签: android google-play android-webview android-security sslerrorhandler


【解决方案1】:

显示带有继续和取消的弹出窗口或对话框。
继续 handler.proceed()
取消 handler.cancel()

当出现此错误时,我们需要询问用户是继续还是停止。

像这样

val builder = AlertDialog.Builder(cntx)
        var message = "SSL Certificate error."
        when (error?.primaryError) {
            SslError.SSL_UNTRUSTED -> message = "The certificate authority is not trusted."
            SslError.SSL_EXPIRED -> message = "The certificate has expired."
            SslError.SSL_IDMISMATCH -> message = "The certificate Hostname mismatch."
            SslError.SSL_NOTYETVALID -> message = "The certificate is not yet valid."
        }
        message += " Do you want to continue anyway?"

        builder.setTitle("SSL Certificate Error")
        builder.setMessage(message)
        builder.setPositiveButton(
            "continue"
        ) { dialog, which -> handler?.proceed() }
        builder.setNegativeButton(
            "cancel"
        ) { dialog, which -> handler?.cancel() }
        val dialog = builder.create()
        dialog.show()

【讨论】:

    猜你喜欢
    • 2020-08-03
    • 2017-07-07
    • 2017-10-27
    • 1970-01-01
    • 2020-05-01
    • 1970-01-01
    • 2016-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多