【Android】配置lambda与解决butterknife不兼容问题

135 阅读1分钟
原文链接: www.jianshu.com

使用第三方Java8兼容插件解决lambda与butterknife的兼容问题,即使项目中没有使用到butterknife,也推荐使用第三方兼容插件

配置

工程的build.gradle中添加

dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'me.tatarka:gradle-retrolambda:3.2.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

app.gradle中添加

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
   ···
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}