android interface用法,Android项目使用OkHttp3的时候报错Static interface methods are only supported starting with...

一个老的项目在引入OkHttp3最新版本3.13.1之后编译报错,信息如下

AGPBI: {“kind”:”error”,”text”:”Static interface methods are only supported starting with Android N (–min-api 24): okhttp3.Request okhttp3.Authenticator.lambda$static$0(okhttp3.Route, okhttp3.Response)”,”sources”:[{}],”tool”:”D8”}

去OkHttp官方看了一下3.13.1的release note,有一段信息如下

This release bumps our minimum requirements to Java 8+ or Android 5+. Cutting off old devices is a serious change and we don’t do it lightly! This post explains why we’re doing this and how to upgrade.

The OkHttp 3.12.x branch will be our long-term branch for Android 2.3+ (API level 9+) and Java 7+. These platforms lack support for TLS 1.2 and should not be used. But because upgrading is difficult we will backport critical fixes to the 3.12.x branch through December 31, 2020.

3.13.1这个版本最低版本需要Java8+或Android 5+支持,如果你需要兼容老设备,用之前的版本就行了,如果只是想编译通过,可以在gradle文件里面添加下面配置信息

compileOptions {

targetCompatibility = "8"

sourceCompatibility = "8"

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值