在 sdk < 21 上改造 2

Beh*_*ard 5 android okhttp retrofit2 okhttp3 retrofit2.6

我在我的 android 应用程序中使用了Retrofit库。我的项目的minSDK是 16。现在我看到由于改造版本,我的应用程序无法在 SDK < 21 上运行。我的改造版本:

implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
Run Code Online (Sandbox Code Playgroud)

我测试了OkHttp 2,但它不适用于我的改装。我该怎么办?

小智 -1

在构建 gradle 文件中添加以下行:

    // retrofit, gson
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.2'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation 'com.squareup:otto:1.3.8'
    implementation 'com.google.code.gson:gson:2.8.5'
Run Code Online (Sandbox Code Playgroud)

这是完整的改造包