Android Studio - Kotlin - OkHttp3 报错 Expected Android API level 21+ but was 30
程序员文章站
2022-06-23 13:17:51
Android Studio - Kotlin - OkHttp3 报错 Expected Android API level 21+ but was 30在 Android 11 虚拟机上报错,在自己的 Android 10 手机上运行正常,当时看到 Expected Android API level 21+ but was 30 都蒙了,支持 21+,这 30 ???Caused by: java.lang.IllegalStateException: Expected Android API l...
问题
Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 30
在 Android 11 虚拟机上报错,在自己的 Android 10 手机上运行正常,当时看到 Expected Android API level 21+ but was 30 都蒙了,支持 21+,这 30 ???
解决
查看 Okhttp3 版本,编辑器推荐的:
implementation 'com.squareup.okhttp3:okhttp:4.2.0'
网上找了很久都没有,后来到官网,根据官网改成了最新版:
implementation("com.squareup.okhttp3:okhttp:4.8.1")
Sync 后,问题解决
OkHttp 官网
https://square.github.io/okhttp/
本文地址:https://blog.csdn.net/Moriafly/article/details/107854016