Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Annotation processors must be explicitly declared now #48

Open
rasmusohrstig opened this issue Dec 3, 2019 · 1 comment
Open

Annotation processors must be explicitly declared now #48

rasmusohrstig opened this issue Dec 3, 2019 · 1 comment

Comments

@rasmusohrstig
Copy link

I'm trying to import the library in Android studio using Gradle like so:

dependencies {
...
implementation "io.fabric8:mockwebserver:0.1.7"
}

When building the code I get the following error:

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.

  • builder-annotations-0.13.1.jar (io.sundr:builder-annotations:0.13.1)
  • resourcecify-annotations-0.13.1.jar (io.sundr:resourcecify-annotations:0.13.1)
    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.

I have tried this:

dependencies {
...
implementation "io.fabric8:mockwebserver:0.1.7"
annotationProcessor "io.sundr:builder-annotations:0.13.1"
annotationProcessor "io.sundr:resourcecify-annotations:0.13.1"
}

and this:

dependencies {
...
implementation "io.fabric8:mockwebserver:0.1.7"
annotationProcessor "io.sundr:builder-annotations:0.13.1"
}

but it results in duplicate imports of various classes.

The deprecated workaround android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true no longer works now.

What is the best way to import this library in Android Studio?

@rasmusohrstig
Copy link
Author

I was able to solve this myself.

The problem seems to happen when you import the library in one Kotlin module and then import code from that module in another module.

The solution seems to be to import the library like this in the first module:

annotationProcessor "io.sundr:builder-annotations:0.13.1"
annotationProcessor "io.sundr:resourcecify-annotations:0.13.1"
implementation ("io.fabric8:mockwebserver:0.1.7") {
    exclude group: 'io.sundr', module: 'sundr-codegen'
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant