0
我創建了一個全新的Android項目並添加了lombok支持。將lombok添加到使用Java的Android項目中8
當我在Java 7上開發時,一切正常,但是我更新了語言級別爲8,lombok編譯器停止了運行。
我在做的gradle更新語言到Java 8的變化是:
jackOptions {
enabled true
}
和
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
我gradle這個是:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.instatrivia"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
buildToolsVersion '25.0.0'
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.1'
testCompile "junit:junit:$rootProject.junitVersion"
// Android support libs
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:design:$rootProject.supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:support-v4:$rootProject.supportLibraryVersion"
// dagger
compile "com.google.dagger:dagger:$rootProject.dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger_version"
// testApt "com.google.dagger:dagger-compiler:$rootProject.dagger_version"
// rx java/android
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
provided 'javax.annotation:jsr250-api:1.0'
compile 'javax.inject:javax.inject:1'
// misc
provided "org.projectlombok:lombok:1.16.14"
compile "com.google.guava:guava:$rootProject.guavaVersion"
compile "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
我得到的錯誤構建過程是:
Warning:You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.
Your processor is: com.android.jack.eclipse.jdt.internal.compiler.apt.dispatch.BatchProcessingEnvImpl
Lombok supports: sun/apple javac 1.6, ECJ