AllArgsConstructor from lombok is not found by Android Studio

lombok constructor super
lombok annotations
lombok static constructor
lombok allargsconstructor meaning
intellij lombok not working
the constructor is undefined lombok
lombok required fields
lombok eclipse

When I create a new Java class with one or more field and attach the @AllArgsConstructor annotation from lombok to it, then i get this message

Error:(9, 1) error: cannot find symbol class ConstructorProperties

from the on the Gradle Build console. I was able to reproduce this by creating a new empty Android project with this configuration.

The Class (never used or instantiated)

@lombok.AllArgsConstructor
public class Model {
    int foo;
    String bar;
}

build.gradle:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
provided 'org.projectlombok:lombok:1.14.8'
}

@Getter and @Setter from lombok do not cause any problems and even the @NoArgsConstructor is not mentioned by gradle, so is the AllArgsConstructor if there are no fields.

Is this a bug from Lombok or is this bug located in front of the screen?

Lombok generates the @ConstructorProperties by default for all generated constructors. On Android, that annotation is not available. As mentioned in the documentation it is possible to suppress the generation by either specifying suppressConstructorProperties=true for each @XxxArgsConstructor, or by using the following line in a high level lombok.config file:

lombok.anyConstructor.suppressConstructorProperties = true

Disclosure: I am a Lombok developer

Can't compile when using a class enhanced with Lombok · Issue , When I create a new Java class with one or more field and attach the @​AllArgsConstructor annotation from lombok to it, then i get this message. Lombok generates the @ConstructorProperties by default for all generated constructors. On Android, that annotation is not available. As mentioned in the documentation it is possible to suppress the generation by either specifying suppressConstructorProperties=true for each @XxxArgsConstructor, or by using the following line in a high level lombok.config file: lombok.anyConstructor

You need to add suppression in your AllArgsConstructors. If you don't want to add a new config file, you can simply do this:

@AllArgsConstructor(suppressConstructorProperties = true)

Disclosure: I'm not a Lombok developer :D

NoArgsConstructor, @RequiredArgsConstructor , But I've found a problem using it with Lombok. @AllArgsConstructor(access = AccessLevel. I'm using Android Studio by the way. In any case, I believe the issue is with the lombok-intellij-plugin, not the gradle-apt-plugin  Lombok génère le @ConstructorProperties par défaut pour tous les constructeurs. Sur Android, cette annotation n'est pas disponible. Comme indiqué dans le documentation il est possible de supprimer la génération en spécifiant soit suppressConstructorProperties=true pour chaque @ Xxxargsconstructeur, ou en utilisant la ligne suivante à un niveau élevé lombok.config fichier:

Also:

If you target Java 8 in your Android project (e.g. by using retrolambda) this error will not appear.

Gradle, @NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor. Constructors made to order: Generates constructors that take no arguments, one​  I'm using Android Studio 2.2 Preview 7, and the Lombok plugin suddenly started saying: Annotation processing seems to be disabled for the project X, and providing a link to settings. Clicking on the notification does not take me to the right place.

@AllArgsConstructor(suppressConstructorProperties = true) solution is not working anymore. If you try this, you get the following:

This deprecated feature is no longer supported. Remove it; you can create a lombok.config file with 'lombok.anyConstructor.suppressConstructorProperties = true'.

The working solution is adding lombok.anyConstructor.suppressConstructorProperties = true to lombok.config file.

Data, does not need to be present when running/testing/jarring/otherwise deploying Complete instructions for integrating lombok with your android development  I just upgrade my Android Studio to 3.3.2 and installed the Lombok plugin. I need to re-activate my annotation processor, but the option doesn't appear to be there anymore. So where is it?

I had the same problem after updating Android Studio.

None of the another answers including accepted one helped me.

Finally I have updated the lombok version to 1.16.20 (the latest for today) and the error disappeared.

Hope it will save time for someone.

Write Fat-free Java Code with Project Lombok, All static fields will be skipped entirely (not considered for any of the generated methods, and no setter/getter will be made for them). If the class already contains a  In addition to setting up your gradle project correctly, you need to add the Lombok IntelliJ plugin to add lombok support to Android Studio: Go to File > Settings > Plugins Click on Browse repositories Search for Lombok Plugin Click on Install plugin Restart Android Studio Modify your application's dependencies block:

Lombok, Lombok does not really fall into these categories: What it does is modify the compiler data We write lots of these, for example when working with JPA or serialization ToString; @Getter @Setter @NoArgsConstructor @​AllArgsConstructor /27969416/allargsconstructor-from-lombok-is-not-found-by-​android-studio. If I have a class with AllArgsConstructor and a superclass with AllArgsConstructor. The generated code only populates the current class fields and does not call super class AllArgsConstructor

Setting up Lombok with Eclipse and Intellij, IntelliJ Lombok plugin. A plugin that adds first-class support for Project Lombok. Sponsors. Discussing code is now as easy as highlighting a block and typing a  @NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor Constructors made to order: Generates constructors that take no arguments, one argument per final / non-null field, or one argument for every field.

User Roel Spilker, After installing it, the errors go away and regular features like Find Usages, Navigate To start working. We need to go to the Preferences | Plugins,  Lombok is a clever hack, but an hideous hack anyway, and I strongly believe no sane person should be using Lombok. There are non-hackish alternatives, even if they're not always automated at the same level (at a minimum, use delombok to generate plain Java sources so that you don't need to inject Lombok's hacks everywhere in your toolchain).

Comments
  • Hey Roel. I am having the exact same problem (I am new with lombok). I am using Android Studio 1.3 preview 4, lombok1.12.6 and lombok plugin 0.9.4.14. In my project root I have a lombok.conifg file with two lines: lombok.anyConstructor.suppressConstructorProperties = true and config.stopBubbling = true. But I still get the same error as Ohem. Can you please help me?
  • AFAIK, Android Studio is based on IntelliJ. It could be that the IntelliJ plug-in, that is developed by a different developer, does not yet support the config system.
  • Aah I see. So I guess the only way is to add explicitly @AllArgsConstructor(suppressConstructorProperties = true) right? Btw, really nice work with lombok. Keep going this way ;)
  • FYI, I can now use lombok.config with IntelliJ 14, Lombok plugin 0.9.6.14 and Lombok 1.16.4. Nice job, guys! +1
  • This does not work on Android studio ? I've installed plugin as well
  • Love your disclosure :-)