Amir Ebrahimi
Amir Ebrahimi

Reputation: 547

Lombok not working Android Studio 3.0

I want to use Lombok in one of my projects in android studio 3.0 and I have problems with it. Annotations work fine and they don't have any errors. Here are my Gradle dependencies which I added Lombok in it.

compileOnly "org.projectlombok:lombok:1.16.18"
annotationProcessor "org.projectlombok:lombok:1.16.18"

I have a problem with Annotation Processors too.
I have followed these steps:

when the Android Studio restarts the Annotation Processors setting is gone but the plugin doesn't show any errors.

After doing all this still it doesn't work.

import com.google.gson.annotations.SerializedName;

import lombok.Getter;

class UserModel {

    @SerializedName("uid")
    @Getter private String userId;


}

this is how I defined my model and cant get the getUserId out of it.

Upvotes: 5

Views: 3624

Answers (2)

juanlugm
juanlugm

Reputation: 155

Same issue for me. Android Studio 3.2 default config.

-Installed Lombok plugin -Added the following to app dependencies compileOnly 'org.projectlombok:lombok:1.18.4' annotationProcessor 'org.projectlombok:lombok:1.18.4'

And Lombok annotations were just ignored. After restarting Android Studio I got the Event log saying Lombok requires annotation processing, but Preferences/ Build Exec.../Compiler didn't show anything under it.

File / Invalidate caches restart did the trick. After that I could see the annotation processors option.

Upvotes: 2

Amir Ebrahimi
Amir Ebrahimi

Reputation: 547

I have fixed this after doing the works above I restarted my pc and suddenly everything was working allright

Upvotes: 0

Related Questions