Android Studio 3 RC2 出现错误 "package lombok doesn't exist"

Getting error "package lombok doesn't exist" with Android Studio 3 RC2

我在尝试编译项目时遇到以下错误:

error: package lombok does not exist

还有人说找不到其中的所有注释。

我在编译之前没有看到代码中的错误,而且我在使用 Android Studio 3 RC1 时也没有出现这个错误。

这是我的 gradle 脚本:

项目级别:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-rc2'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用模块级别:

apply plugin: 'com.android.application'

android {
        compileSdkVersion 26
        buildToolsVersion "26.0.2"
        defaultConfig {
            applicationId "com.mk.forum"
            minSdkVersion 25
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
        compile project (':util')
        compile project (':forum_core')
        compileOnly 'org.projectlombok:lombok:1.16.18'
        annotationProcessor 'org.projectlombok:lombok:1.16.18'
        compile group: 'com.github.javafaker', name: 'javafaker', version: '0.13'
    }

我也有模块,不过我觉得不重要。

我希望是因为 compileOnly 注释。这是文档: blog.gradle.org/introducing-compile-only-dependencies

  • Dependencies required at compile time but never required at runtime, such as source-only annotations or annotation processors;

  • Dependencies required at compile time but required at runtime only when using certain features, a.k.a. optional dependencies;

  • Dependencies whose API is required at compile time but whose implementation is to be provided by a consuming library, application
    or runtime environment.

可能与jdk9有关。我知道 IntelliJ、lombok 1.16.18 和 jdk9 的组合目前不起作用。但这并不能解释您的错误消息。我们预计我们可以在几天内(可能是今晚)发布解决此问题的 1.16.20。

披露:我是一名龙目岛开发者。