How to fix Expected Android API level 21+ but was 19 in Android

后端 未结 11 1797
甜味超标
甜味超标 2020-12-10 01:06

In my application i want get data from server, for get connect to server i used Retrofit, OkHttp.
But when running application, show me

11条回答
  •  没有蜡笔的小新
    2020-12-10 02:09

    Android 4.x?

    Google’s distribution dashboard shows that ~11% of the devices that visited the Play Store in October 2018 were running Android 4.x. We’ve created a branch, OkHttp 3.12.x, to support these devices. Should we encounter any severe bugs or security problems we’ll backport the fixes and release. We plan to maintain this branch through December 31, 2020.

    If you really need TLSv1.2 on Android 4.x, that’s possible! Ankush Gupta has written a thorough guide that explains how to get Google Play Services to do it. Even if you follow this process you should still use OkHttp 3.12.x with Android 4.x devices.

    so you can use below code and resolve your problem

      implementation ("com.squareup.okhttp3:okhttp:3.12.12"){
      force = true //API 19 support
      }
      implementation 'com.squareup.okhttp3:logging-interceptor:3.12.12'
    

提交回复
热议问题