美文网首页网络
android 引入OKhttp在安卓4.x手机无法运行、闪退解

android 引入OKhttp在安卓4.x手机无法运行、闪退解

作者: black_history | 来源:发表于2019-07-14 03:28 被阅读62次

https://square.github.io/okhttp/有这么一段话:

Requirements

OkHttp works on Android 5.0+ (API level 21+) and on Java 8+.

OkHttp has one library dependency on Okio, a small library for high-performance I/O.

We highly recommend you keep OkHttp up-to-date. As with auto-updating web browsers, staying current with HTTPS clients is an important defense against potential security problems. We track the dynamic TLS ecosystem and adjust OkHttp to improve connectivity and security.

OkHttp uses your platform’s built-in TLS implementation. On Java platforms OkHttp also supports Conscrypt, which integrates BoringSSL with Java. OkHttp will use Conscrypt if it is the first security provider:
Security.insertProviderAt(Conscrypt.newProvider(), 1);
The OkHttp 3.12.x branch supports Android 2.3+ (API level 9+) and Java 7+. These platforms lack support for TLS 1.2 and should not be used. But because upgrading is difficult we will backport critical fixes to the 3.12.x branch through December 31, 2020.

说的很清楚,安卓平台,OKhttp最低支持5.0的系统。
要兼容4.x,就用3.12.x的版本:
implementation("com.squareup.okhttp3:mockwebserver:3.12.0")
3.12.x目前最新3.12.3经测试正常

相关文章

网友评论

    本文标题:android 引入OKhttp在安卓4.x手机无法运行、闪退解

    本文链接:https://www.haomeiwen.com/subject/gxwvkctx.html