我想在我的代碼使用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'' –