我想在我的代码使用Lambda表达式,我得到这个错误:lambda表达式没有在这个语言层面支持使用Lambda表达式和Butterknife
我只是寻找它在SO,发现一个解决方案添加这摇篮文件:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
...
jackOptions {
enabled true
}
}
后来我有一个新的错误:错误:无法获取不明财产“类路径”任务“:应用程序:transformJackWithJackForDebug”型com.android.build.gradle.internal的。 pipeline.TransformTask。
搜查如此反复,发现这是因为我不能在同一时间使用千斤顶和容易...所以我删除容易删除这些行:
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
...
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
...
}
,并得到了新的错误,因为黄油刀需要...
那么如何在同一个项目中使用Lambda和Butterknife?
Butterknife 8.5不需要设置'apt'。最近的设置只需要:'compile'com.jakewharton:butterknife:8.4.0' annotationProcessor'com.jakewharton:butterknife-compiler:8.4.0'' –