android – Error:Failed to resolve: annotationProcessor-ThrowExceptions

Exception or error:

This is the following error I am getting while adding a new gradle dependency to my android project. And this error is not project specific. I am getting the same error if I am adding the plugin in any other android project
Error while adding any third party plugin

I also posted my project app level gradle module screenshot

App level gradle module

I even enabled Annotation Processor in the settings. Still no solution. Please help.

How to solve:

use this in your project gradlefile:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}

###

I had same issue, and problem was I forgot to add;

repositories {
    maven { url 'https://jitpack.io' }
}

###

For those who just downloaded Android studio 3.0 update and got the :

Failed to resolve annotationProcessor

Solution: Disable the annotation processor error check

Simply copy the ‘JavaCompileOptions’ code block below and paste in the defaultConfig{} block.

android {
    ...
    defaultConfig {
        ...
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath false
            }
        }
    }
}

Ref: Disable the annotation processor error check

###

Well ok, now finally after struggling with this issue with annotationProcessor can’t be resolved, I can tell that it is a library issue or configuration issue on your side, since you are using 3rd party plugins.

In case of library issue, it might occur in case some of magic wasn’t applied to generate javadoc tasks to include javadocDepts into classpath.

Issue with configuration might be that there are custom annotations, but no custom annotation processor, or you didn’t include it in dependencies as annotationProcessor 'package.name:annotationProcessorModule:version'

Anyways, I had to remove custom annotations from my own library to be able to use artifact from jcenter, otherwise I would get

Failed to resolve annotationProcessor

all the time as well, when using my library in other project.

Here’s the link to my question and my repository in case it might help you if you are developing those 3rd party plugin yourself:

Can't import AAR library with @IntDef annotations

https://github.com/vulko/AnimatedArcProgressView

###

First of all try to clean project.
It will give you more information about the error and add the following line in your project build.gradle file.

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

then rebuild the project it should work

###

In our case our internal artifact server was down so it was indeed failing to resolve.

What I would recommend is running your gradle build from command line and adding the --debug parameters to it. Then you’ll see lines like the following that will help you see what is failing to resolve. (Note I cut out a bunch of stuff to keep the log short here.)

[org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper]     tried http://repo.jfrog.org/...
...
[org.apache.http.impl.conn.DefaultClientConnection] Sending request: HEAD /artifactory/...
[org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 404 Not Found

Leave a Reply

Your email address will not be published. Required fields are marked *