问题
OkHttp has recently dropped support for Android 4, except via a separate 3.12.x branch that will be supported until end of Dec 2020 (and probably receive no more than critical updates or bugfixes).
On the assumption that you wish to continue to support Android 4, like I do, since 10% of the Android user base is still a significant proportion, and don't want to be stuck in a dead-end branch...
Rather than being stuck on the 3.12.x
branch for all sdk versions, is there any way of using the 3.12
branch for sdk < 21
and the 3.13
branch for sdk >= 21
, a bit like it would of course be possible to use HttpUrlConnection
for sdk < 21
and OkHttp 3.13
for sdk >= 21
?
来源:https://stackoverflow.com/questions/54652219/okhttp-support-for-sdk-versions-less-than-21