Lombok is a library that simplifies boilerplate such as Java getters / setters. Just annotate the field methods and they will automatically generate the code at compile time. You don't have to do the automatic generation in the IDE, which you would have done so far, and you can also reduce change mistakes. Click here for GitHub.
macOS Android Studio 2.2.3 Gradle 2.14.1 Gradle Plugin 2.2.3
From the menu, click Android Studio → Preferences ... → Plugins → Browse repositories ...
Search for "lombok" and select "Lombok Plugin"
Click the "Install" button to install
Restart Android Studio
Write the following in the dependencies block of build.gradle (Module: app) Excerpt from README.
build.gradle
dependencies {
provided 'org.projectlombok:lombok:1.16.12'
}
Since lombok is used only at compile time, it should be "provided" instead of "compile".
Click File → Other Stetting → Default Settings ... → Build, Execution, Deployment → Compiler → Annotation Processors If the project is not open, you can go to Configure → Preferences → Build, Execution ...
Check Enable annotation processing
Please refer to the following article for how to use it.
I will also post the official website.
Recommended Posts