Android studio 导入依赖, 构建时报错

错误如下 : 

Static interface methods are only supported starting with Android N (--min-api 24): void butterknife.Unbinder.lambda$static$0()
Message{kind=ERROR, text=Static interface methods are only supported starting with Android N (--min-api 24): void butterknife.Unbinder.lambda$static$0(), sources=[Unknown source file], tool name=Optional.of(D8)}

Static interface methods are only supported starting with Android N (--min-api 24): void butterknife

提示的意思是 最小api应为24 , 实验 将最小 api版本改为26后, 能在 Android  O 的设备上运行,

但是由于App 肯定不能只适配 8.0以上的设备 , 所以还得另寻方法

最后发现这问题都是因为没有指定jdk 1.8而产生的

在app build:gradle 中的android 下添加 指定jdk版本的代码,如下:

android {
    ......
    //指定jdk版本
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

相关文章:

  • 2021-08-13
  • 2021-12-18
  • 2021-04-29
  • 2021-08-20
猜你喜欢
  • 2021-08-30
  • 2021-07-20
  • 2021-10-20
  • 2021-09-17
  • 2021-06-30
  • 2021-05-03
  • 2021-05-02
相关资源
相似解决方案