- Install the Lombok plugin via Android Studio -> Preferences -> Plugins (Search repositories).
- Enable Annotation Processing. With the project open go to: File -> Other Settings -> Default Settings Build, Executio... -> Compiler -> Annotation Processors
- Finally to be sure click File -> Invalidate Cache and Restart Android Studio
- Remove tonnes of boilerplate around generating value classes, getter/setters, builders, null value checks, all kinds of good stuff. See https://projectlombok.org/features/index.html
In this example I just use the @Data
annotation to generate getters/setters, toString()
and hashCode()
- in reality you may want to use the @Getter
annotation and others to exact a more fine grained control (or to generate immutable classes with @Value
).
Have you tried using
@Builder
annotation ? It seems to fail compiling, withError:(xxx, xxx) Gradle: The method builder() is undefined for the type xxxxxxxxxxxxxxxx