0

I want use lombok in Android Studio 3.0

I get error

Error:Execution failed for task ':app:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.
    - lombok-1.16.18.jar (org.projectlombok:lombok:1.16.18)
  Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.
  See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

My gradle dependency

compileOnly "org.projectlombok:lombok:1.16.18"
ip696
  • 6,574
  • 12
  • 65
  • 128
  • Ok did you tried this : `compile 'org.projectlombok:lombok:1.16.18' annotationProcessor "org.projectlombok:lombok:1.16.18"` –  Nov 04 '17 at 16:10
  • yes. but I get error - Error:(19, 1) error: package javax.annotation does not exist – ip696 Nov 04 '17 at 16:14
  • 1
    Then this should work : `compileOnly 'javax.annotation:javax.annotation-api:1.2' compileOnly "org.projectlombok:lombok:1.16.18" annotationProcessor "org.projectlombok:lombok:1.16.18"` –  Nov 04 '17 at 16:18

1 Answers1

1

try

compile 'org.projectlombok:lombok:1.16.18' annotationProcessor "org.projectlombok:lombok:1.16.18"

You can disable the generation of javax.annotation.Generated by putting the following line in a lombok.config file in one of the top directories of your project:

lombok.addGeneratedAnnotation = false

See the configuration documentation for more information.

Nawrez
  • 3,314
  • 8
  • 28
  • 42