Jai
Jai

Reputation: 257

Lombok not working with Android Studio 3.4

After updating android studio to 3.4, am facing issues with lombok plugin. Though inside model class, annotations are recognised and showing properly, in activity all getter and setter functions i have used, are not recognised. I can build project as well, but in all activities all getter and setter functions are showing in red color. Any help is much appreciated.

I tried enabling annotation processor for android-studio. I am using lombok as dependency as given in the website, with annotation processor. Gradle version is 3.4.0.

Upvotes: 3

Views: 6961

Answers (4)

Babu
Babu

Reputation: 5240

I had similar issue with Android Studio 3.6.1.

  • 1) enable annotation processing (same as other answers here)
  • 2) check versions of com.android.tools.build:gradle vs org.projectlombok:lombok

Lombok

    compileOnly "org.projectlombok:lombok:1.18.12"
    testCompileOnly "org.projectlombok:lombok:1.18.12"
    kapt 'org.projectlombok:lombok:1.18.12'
    annotationProcessor 'org.projectlombok:lombok:1.18.12'

This combination worked for me:

 dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'

This not:

        classpath 'com.android.tools.build:gradle:3.6.1'

Upvotes: 1

Shendre Kiran
Shendre Kiran

Reputation: 157

If annotation processor is already enabled (Configure - Settings - Build, Execution, Deployment - Compiler - Annotation Processors - Enable annotation processing) and even after restarting the system, lombok doesn't work, then just uninstall lombok plugin, re-install it and restart the android ide.

UnInstall: File --> Settings --> Plugins --> Installed --> select Lombok --> Select uninstall from drop down (top right corner)

Install: File --> Settings --> Plugins --> Marketplace --> serach Lombok --> click install --> restart android IDE

UN-Installing plugin

enter image description here

Installing plugin:

Upvotes: 1

ovicko
ovicko

Reputation: 2302

Enable Annotation Processing in Android Studio 3.4
1. Android Studio - File - Close Project
2. Configure - Settings - Build, Execution, Deployment - Compiler - Annotation Processors - Enable annotation processing.

enter image description here

  1. Open Project - Build - Rebuild Project.

Upvotes: 7

Jai
Jai

Reputation: 257

For me, i didn't install the plugin. That's why i think android studio was not able to recognise annotations but i was able to build the project. I end up putting dependency in gradle file and installing the plugin through settings and now everything is working!

Upvotes: 3

Related Questions