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 error, that is "error: Cannot find getter for field".
But if I remove any one of them, it'll work fine.
Please help!!!
I have the same problem. Did you found any solution?
Anyone know if I can set the annotation processor order?
No, i did not found any solution for this.
Try using public modifier and write its getter and setter
Same problem..Is there any workaround for lombok and room to be working together?
any workaround for this issue ?
Not yet.
Change private to public, if you need this property private so add getter. This work for me.
annotationProcessor MUST be in order.
compile 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
Ok, I'll check and let you know.
Like @s6mna9 said, annotationProcessor must be in order. After reorder - problem fixed.
For Room :
In my case
public String getpBSalesTotal() {
return pBSalesTotal;
}
public void setpBSalesTotal(String pBSalesTotal) {
this.pBSalesTotal = pBSalesTotal;
}
is the previous POJO class that i want as a table in my database.
I have just changed small "" p "" to capital ""P"" and that solved my error. Like below
public String getPBSalesTotal() {
return pBSalesTotal;
}
public void setPBSalesTotal(String pBSalesTotal) {
this.pBSalesTotal = pBSalesTotal;
}
to generate this type of
POJO form JSON
you can use this LINK. It worked for Room.
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"
@Zer0bee, does the solution @NMNaufaldo suggested work for you?
Oh, I already see a previous similar suggestion with confirmation, so I expect this to work.
Nice :)
On Wed, Jan 15, 2020 at 3:59 AM Roel Spilker notifications@github.com
wrote:
Closed #1403 https://github.com/rzwitserloot/lombok/issues/1403.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/rzwitserloot/lombok/issues/1403?email_source=notifications&email_token=AI54KZ5TU66XV3VXYWFLD2LQ5YRTXA5CNFSM4DM6SUX2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOV7ADB2I#event-2948608233,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AI54KZ6UQV4W6S36K2HAW7LQ5YRTXANCNFSM4DM6SUXQ
.
Working fine now after reordering 'ap'.
Most helpful comment
annotationProcessor MUST be in order.
compile 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'