19

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.

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
sagar suri
  • 4,351
  • 12
  • 59
  • 122

6 Answers6

23

use this in your project gradlefile:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}
Ashwani Kumar
  • 834
  • 3
  • 16
  • 30
14

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

repositories {
    maven { url 'https://jitpack.io' }
}
Mohamed
  • 1,251
  • 3
  • 15
  • 36
  • No, that's not the issue in my case – Kirill Volkov May 06 '17 at 15:04
  • 4
    That was my issue hahaha, damm... I actually had added to buildscript instead of allprojects – Pozzo Apps Jun 28 '17 at 15:51
  • This does not fix the problem for me. @KirillVolkov did you solve your problem? – MAESTRO_DE Nov 18 '18 at 15:56
  • @Marcel1997 I did solve this by removing custom annotations from my library. Not sure what is current state of this option, but as I got it, back then (~2 years ago), custom annotations in a library weren't supported, unless using an annotation processor. – Kirill Volkov Dec 06 '18 at 18:19
5

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

Kenny Dabiri
  • 353
  • 3
  • 22
2

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

Community
  • 1
  • 1
Kirill Volkov
  • 942
  • 1
  • 9
  • 18
1

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

waka
  • 3,362
  • 9
  • 35
  • 54
Dhananjay
  • 161
  • 2
  • 3
0

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
BoredAndroidDeveloper
  • 1,251
  • 1
  • 11
  • 26