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:
file>other settings>default settings
i have enabled the Annotation Processors
Invalidate Caches / Restart
project settings
suddenly the Annotation Processors
settings appeared under the Build, Execution, Deployment>Compiler
menu which it was not there before Invalidating Cache
and I check its tick. 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.
我做完上面的工作后修复了这个我重新启动我的电脑,突然一切都工作正常
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.