After Gradle update in my Android Studio I’m getting a hint / warning:
“Add annotation processor to processor path using annotationProcessor instead of compileOnly”
Here is the code:
Tried to search all over the Internet but there are none pages having content about this.
If I replace it with
annotationProcessor, Lombok stops working.
What is the right way to add the Lombok dependency?
And here are some versions:
Android Studio Giraffe | 2022.3.1 Patch 1
Build #AI-223.8836.35.2231.10671973, built on August 17, 2023
Runtime version: 17.0.6+0-b2043.56-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
- com.intellij.marketplace (223.8836.56)
- com.dguner.lombok-builder-helper (1.5.0)
Android Gradle Plugin Version: 8.1.1
Gradle Version: 8.1.1
Imho the correct solution is to not use Lombok at all.
But if you insist, I suggest you start with RTFM (Reading Their Fine Manual): Gradle
Why would you avoid Lombok? Please can you explain? Thanks
Because I really don’t like it.
It needs deep compiler hacks to work at all which already is a sign it does the wrong thing.
And also it imho does not add much value, especially with recent language additions.
And it makes it harder for people to understand code that calls methods that do not exist, as well as tools that try to understand code which they cannot without adding explicit support for all Lombok features and so on.
And if the less effort to create things like getters, setters, hashCode() and so on is the key point, all are just one key combination away in a decent IDE, so a non-issue.
Oh, for the moment I thought it has to be some valid reason.
Well, they are valid reasons, even if you happen to disagree.
Tried that one but it’s not working.
Tried to add it to
Then tried with
And finally tried with both
Always the same - lombok imports are not recognized.