I'm using Lombok in android studio 3.0 preview with gradle 3.0.0-alpha1. I have following two annotation processor in my dependency:
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1"
annotationProcessor "org.projectlombok:lombok:1.16.16"
Now, If I use annotations from both dependencies in same class like:
@Entity(tableName = "test")
@Getter
public final class TestEntity {...}
It'll produce an error, that is:
error: Cannot find getter for field.
But if I remove any one of them, it'll work fine.
Any ideas/solutions?
Reorder your annotation processor declarations. Move lombok up above the room compiler
From Edwin Nyawoli answer, i just want to make it clear
In your build.gradle module file, reorder Lombok dependency above Room dependency
// Lombok
compileOnly "org.projectlombok:lombok:$lombok_version"
annotationProcessor "org.projectlombok:lombok:$lombok_version"
// Room
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With