我想知道我在Android Studio 3.0 Beta 2的Lombok设置中做错了什么吗?

我的Gradle构建文件就是这样的:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath "io.franzbecker:gradle-lombok:1.10"
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = "MyAppName"
        gdxVersion = '1.7.0'
    }

    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}

project(":desktop") {
    apply plugin: "java"


    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
    }
}

project(":core") {
    apply plugin: "io.franzbecker.gradle-lombok"
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        compileOnly "org.projectlombok:lombok:1.16.18"
    }
}

tasks.eclipse.doLast {
    delete ".project"
}

我已经安装了lombok插件,并且lombok的东西也可以在IDE中正确显示,但是当我要构建项目时,Gradle找不到Lombok创建的getter / setter。我尝试遵循https://projectlombok.org/setup/android和其他堆栈溢出页面中有关此设置的教程,但没有任何效果。在Android Studio 2.3中,我什至无法正确启用注释处理,这就是为什么我更新到了至少可以正常工作的最新Beta版本的原因。

最佳答案

您需要使用新的annotationProcessor而不是apt:Gradle migration annotationProcessor

annotationProcessor "org.projectlombok:lombok:1.16.18"

我遇到了与您相同的问题,现在可以使用了。

07-24 09:47
查看更多