AllArgsConstructor from lombok is not found by Android Studio

后端 未结 6 1211
猫巷女王i
猫巷女王i 2020-12-09 16:50

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

Err

6条回答
  •  天命终不由人
    2020-12-09 17:06

    Annotation suppressConstructorProperties is now not supported by Lombok. If you try to remove (suppressConstructorProperties = true), you would be getting the following error:

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

    Below are the steps to solve this problem: 1. Remove (suppressConstructorProperties = true) from the object. 2. Go to project level dir. in your app and create a lombok.config file. 3. Paste below code in the config file.

    config.stopBubbling = true
    lombok.addGeneratedAnnotation = false
    lombok.accessors.chain = false
    lombok.anyConstructor.suppressConstructorProperties = true
    

提交回复
热议问题