android - 使用 HostnameVerifier 接口(Kotlin)的不安全实现的 Android 应用
问题描述
该应用程序是在 Kotlin 中开发的,我使用 okHttpClient 进行 API 调用我试图将它托管在 Play 商店中,但它们给了我一个漏洞问题:
HostnameVerifier
Your app(s) are using an unsafe implementation of the HostnameVerifier interface. You can find more information about how to resolve the issue in this Google Help Center article.
我的代码:
private val gson = GsonBuilder().setLenient().create()
private var httpLogger = HttpLoggingInterceptor()
.setLevel(HttpLoggingInterceptor.Level.BODY)
private val customClient = OkHttpClient.Builder()
.addInterceptor(httpLogger)
.addInterceptor(ConnectivityInterceptor())
.build()
private val sRetrofitBuilder = Retrofit.Builder()
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(customClient)
.addConverterFactory(GsonConverterFactory.create(gson))
.baseUrl(DataUtils.getString(R.string.api_base_url))
.build()
该应用程序在调试版本中运行良好
解决方案
推荐阅读
- javascript - 如何知道选定的 div ?角
- matlab - matlab中的转置
- php - 从 Xcode 12.2 dlopen libquic 调用 Php 代码时出错失败
- xslt - 在 xsl:if 中使用 XSL:sort
- python - tkinter 文本框没有正确打印列表?
- c# - [EFCore 5, SQLite3]:如何创建没有 ROWID 的表
- oracle - ItemPreparedStatementSetter 在 out 参数中无效
- python - 无法使用 Selenium 单击按钮
- c# - 如何将 MS_DESCRIPTION 属性添加到 M:N 连接表中的列?
- bash - 我可以使用 sed 替换最后一个 html 标记实例之前的所有内容吗?