3

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.

Jai
  • 217
  • 1
  • 4
  • 15

4 Answers4

7

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.
ovicko
  • 2,242
  • 3
  • 21
  • 37
3

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!

Jai
  • 217
  • 1
  • 4
  • 15
1

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:

Shendre Kiran
  • 157
  • 2
  • 8
1

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'
Babu
  • 4,324
  • 6
  • 41
  • 60