Search code examples
androidlombokandroid-roomintellij-lombok-plugin

Lombok not working with "Android room". Gives "error: Cannot find getter for field"


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?


Solution

  • Reorder your annotation processor declarations. Move lombok up above the room compiler