问题描述
我怎么可能收到此消息?这没有任何意义。
我正在使用com.squareup.retrofit2:retrofit:2.9.0
Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 30
at okhttp3.internal.platform.Androidplatform$Companion.buildIfSupported(Androidplatform.kt:370)
at okhttp3.internal.platform.Platform$Companion.findplatform(Platform.kt:204)
at okhttp3.internal.platform.Platform$Companion.access$findplatform(Platform.kt:178)
2020-09-16 12:37:07.645 6480-6480/lv.ltt.gasogmp.dev_v3 E/AndroidRuntime: at
okhttp3.internal.platform.Platform.<clinit>(Platform.kt:179)
解决方法
添加对OkHttp 4.9.0的显式依赖。或阅读本文时最新的内容。
此错误令人尴尬,但已修复了很长时间,以至您不应该在新代码中遇到它。
,只需添加依赖项implementation 'com.squareup.okhttp3:okhttp:4.9.0'