使用ButterKnife gradle正常,编译失败,报错:
> Transform butterknife-runtime.aar (com.jakewharton:butterknife-runtime:10.1.0) with DexingTransform
AGPBI: {"kind":"error","text":"Static interface methods are only supported starting with Android N (--min-api 24): void butterknife.Unbinder.lambda$static$0()","sources":[{}],"tool":"D8"}
解决办法:
在app module的build.gradle中添加:
android {
// ...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// ...
}