I would like to know what am I doing wrong in the Lombok setup for Android Studio 3.0 Beta 2?
我想知道我在Android Studio 3.0 Beta 2的Lombok设置中做错了什么?
That's how my Gradle build file looks like:
这就是我的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"
}
I have installed the lombok plugin, and lombok stuff also shows up properly in the IDE, but when I want to build the project Gradle can not find the getters/setters created by Lombok. I tried to follow the tutorials from https://projectlombok.org/setup/android and other stack overflow pages about this setup, but nothing worked. In Android Studio 2.3 I couldn't even enable the annotation processing properly, that's why I updated to the latest beta version, where that at least works.
我已经安装了lombok插件,lombok在IDE中也显示得很好,但是当我想构建项目时,Gradle无法找到lombok创建的getters/setters。我尝试遵循https://projectlombok.org/setup/android和其他栈溢出页面的教程,但是没有任何工作。在Android Studio 2.3中,我甚至不能正确地启用注释处理,这就是为什么我要更新到最新的beta版本,在那里至少可以工作。
3 个解决方案
#1
4
You need to use new annotationProcessor
instead of apt
: Gradle migration annotationProcessor
您需要使用新的annotationProcessor而不是apt: Gradle migration annotationProcessor
annotationProcessor "org.projectlombok:lombok:1.16.18"
I had the same problem as you and now it works.
我和你有同样的问题,现在它起作用了。
#2
6
I have the same issue. At last I end up with this solution -
我也有同样的问题。最后我得到了这个解
compileOnly 'org.projectlombok:lombok:1.16.18'
compileOnly 'javax.annotation:javax.annotation-api:1.3.1'
annotationProcessor 'org.projectlombok:lombok:1.16.18'
#3
1
I was facing the same issue where upgrading AS to 3.0 and Gradle to 4.1, lombok stopped generating setters/getters.
我面临同样的问题,升级到3.0和Gradle到4.1,lombok停止生成setter /getter。
So If you are using lombok plugin with IntelliJ then for me downgrading lombok from latest stable edge release to 0.15.17.2 solved it.
如果你正在使用lombok插件与IntelliJ,那么我把lombok从最新的稳定边缘版本降级为0.15.17.2就解决了这个问题。
This issue helped me solving it
这个问题帮助我解决了它
#1
4
You need to use new annotationProcessor
instead of apt
: Gradle migration annotationProcessor
您需要使用新的annotationProcessor而不是apt: Gradle migration annotationProcessor
annotationProcessor "org.projectlombok:lombok:1.16.18"
I had the same problem as you and now it works.
我和你有同样的问题,现在它起作用了。
#2
6
I have the same issue. At last I end up with this solution -
我也有同样的问题。最后我得到了这个解
compileOnly 'org.projectlombok:lombok:1.16.18'
compileOnly 'javax.annotation:javax.annotation-api:1.3.1'
annotationProcessor 'org.projectlombok:lombok:1.16.18'
#3
1
I was facing the same issue where upgrading AS to 3.0 and Gradle to 4.1, lombok stopped generating setters/getters.
我面临同样的问题,升级到3.0和Gradle到4.1,lombok停止生成setter /getter。
So If you are using lombok plugin with IntelliJ then for me downgrading lombok from latest stable edge release to 0.15.17.2 solved it.
如果你正在使用lombok插件与IntelliJ,那么我把lombok从最新的稳定边缘版本降级为0.15.17.2就解决了这个问题。
This issue helped me solving it
这个问题帮助我解决了它