How to properly configure Lombok in Android Studio 3.0

I would like to know what I am doing wrong in setting up Lombok for Android Studio 3.0 Beta 2?

What does the Gradle build file look like:

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 installed the lombok plugin and the lombok stuff also renders correctly in the IDE, but when I want to build a Gradle project, I cannot find the recipients / setters created by Lombok. I tried to follow the tutorials https://projectlombok.org/setup/android and other pages about this setting, but nothing worked. In Android Studio 2.3, I was not even able to turn on annotation processing, so I upgraded to the latest beta version, where it at least works.

+7
java android android-studio android-gradle lombok
source share
3 answers

You need to use the new annotationProcessor instead of apt : Gradle migration transfer annotations

 annotationProcessor "org.projectlombok:lombok:1.16.18" 

I had the same problem as yours and now it works.

+3
source share

I have the same problem. Finally, I end up with this decision -

 compileOnly 'org.projectlombok:lombok:1.16.18' compileOnly 'javax.annotation:javax.annotation-api:1.3.1' annotationProcessor 'org.projectlombok:lombok:1.16.18' 
+6
source share

I ran into the same problem when upgrading from AS to 3.0 and Gradle to 4.1, lombok stopped generating setters / getters.

So, if you use the lombok plugin with IntelliJ, then for me, lowering the Lombok from the last stable edge to version 0.15.17.2 solved it.

This problem helped me solve it.

+1
source share

All Articles