Gradle错误:找不到com.android.tools.build:gradle:2.2.3

时间:2022-04-17 22:53:28

I'm trying to build my android project using gradle and circleCI, but I've got this error :

我正在尝试使用gradle和circleCI构建我的android项目,但是我遇到了这个错误:

* What went wrong:
  A problem occurred configuring root project '<myproject>'.
  > Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:2.2.3.
 Searched in the following locations:
     file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
     file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
     https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
     https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
     https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
     https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
 Required by:
     :<myproject>:unspecified

Can someone explain me why I've got this problem please?

有人可以解释一下为什么我有这个问题吗?

11 个解决方案

#1


52  

It seems the current versions of the Android Gradle plugin are not added to Maven Central, but they are present on jcenter. Add jcenter() to your list of repositories and Gradle should find version 2.2.3. On Maven Central the newest available version is 2.1.3: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.android.tools.build%22%20AND%20a%3A%22gradle%22. You can also complain to the authors that the current versions are missing on Maven Central.

似乎Android Gradle插件的当前版本未添加到Maven Central,但它们出现在jcenter上。将jcenter()添加到存储库列表中,Gradle应该找到版本2.2.3。在Maven Central上,最新版本是2.1.3:http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.android.tools.build%22%20AND%20a%3A%22gradle %22。您还可以向作者抱怨Maven Central上缺少当前版本。

#2


23  

Reading sembozdemir answer in this post I have resolved a similar problem adding jcenter() in build.gradle (module: cordovaLib)

在这篇文章中阅读sembozdemir回答我已经解决了在build.gradle中添加jcenter()的类似问题(模块:cordovaLib)

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }

}

#3


18  

After the recent update to Android Studio 3.0 Canary 1, I got the following error:

最近更新到Android Studio 3.0 Canary 1后,我收到以下错误:

> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:3.0.0-alpha1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
     Required by:
         project :

Here is what I had to add (to the project-level build.gradle):

这是我必须添加的内容(到项目级build.gradle):

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
        ....            
    }

Found here: https://developer.android.com/studio/preview/features/new-android-plugin-migration.html

在此处找到:https://developer.android.com/studio/preview/features/new-android-plugin-migration.html

#4


8  

Gradle错误:找不到com.android.tools.build:gradle:2.2.3

buildscript {
repositories {
   mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.0'
}

}

Just change the mavenCentral() to jcenter()

只需将mavenCentral()更改为jcenter()

#5


7  

i had the same issue when i update my android studio to 3.0 then its solved by adding

当我将我的android工作室更新为3.0然后通过添加解决它时,我有同样的问题

buildscript {
     repositories {
    ...
    // You need to add the following repository to download the
    // new plugin.
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
}
 }

from https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#update_gradle

#6


3  

Do you try it

你试试吗

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'

        // NOTE: Do not place your application dependencies here; they belong
    }

}

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

    }

}

and Build->Clear Project

和构建 - >清除项目

#7


1  

Updating CordovaLib -> build.gradle also worked for me, as above. I was looking at the root build.gradle initially which was correct and already included jcenter().

如上所述,更新CordovaLib - > build.gradle也对我有用。我最初看的根build.gradle是正确的,已经包含了jcenter()。

#8


1  

On my side I got the same issue because I used the wrong order of repositories.

在我这边我得到了同样的问题因为我使用了错误的存储库顺序。

google() should be added before jcenter()

应该在jcenter()之前添加google()

buildscript {
    repositories {
        google()
        jcenter()
    }

#9


0  

Change the gradle version as same to android version like Right know we are using 2.3.2 of gradle

将gradle版本更改为与Android版本相同的权利知道我们正在使用2.3.2的gradle

#10


0  

Add jcenter in your project gradle file and sync

在项目gradle文件中添加jcenter并同步

Gradle错误:找不到com.android.tools.build:gradle:2.2.3

#11


0  

The issue is caused by your type of internet connection which prevents or blocks Android Studio from downloading required files from jcenter, this should happen automatically when you build your solution. The solution to your problem is to connect to internet using your personal internet connection such as ADSL Router, rebuild the project and the download of necessary files will happen automatically.

该问题是由您的互联网连接类型导致的,它阻止或阻止Android Studio从jcenter下载所需的文件,这应该在您构建解决方案时自动发生。您的问题的解决方案是使用您的个人互联网连接(如ADSL路由器)连接到互联网,重建项目并自动下载必要的文件。

#1


52  

It seems the current versions of the Android Gradle plugin are not added to Maven Central, but they are present on jcenter. Add jcenter() to your list of repositories and Gradle should find version 2.2.3. On Maven Central the newest available version is 2.1.3: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.android.tools.build%22%20AND%20a%3A%22gradle%22. You can also complain to the authors that the current versions are missing on Maven Central.

似乎Android Gradle插件的当前版本未添加到Maven Central,但它们出现在jcenter上。将jcenter()添加到存储库列表中,Gradle应该找到版本2.2.3。在Maven Central上,最新版本是2.1.3:http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.android.tools.build%22%20AND%20a%3A%22gradle %22。您还可以向作者抱怨Maven Central上缺少当前版本。

#2


23  

Reading sembozdemir answer in this post I have resolved a similar problem adding jcenter() in build.gradle (module: cordovaLib)

在这篇文章中阅读sembozdemir回答我已经解决了在build.gradle中添加jcenter()的类似问题(模块:cordovaLib)

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }

}

#3


18  

After the recent update to Android Studio 3.0 Canary 1, I got the following error:

最近更新到Android Studio 3.0 Canary 1后,我收到以下错误:

> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:3.0.0-alpha1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
     Required by:
         project :

Here is what I had to add (to the project-level build.gradle):

这是我必须添加的内容(到项目级build.gradle):

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
        ....            
    }

Found here: https://developer.android.com/studio/preview/features/new-android-plugin-migration.html

在此处找到:https://developer.android.com/studio/preview/features/new-android-plugin-migration.html

#4


8  

Gradle错误:找不到com.android.tools.build:gradle:2.2.3

buildscript {
repositories {
   mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.0'
}

}

Just change the mavenCentral() to jcenter()

只需将mavenCentral()更改为jcenter()

#5


7  

i had the same issue when i update my android studio to 3.0 then its solved by adding

当我将我的android工作室更新为3.0然后通过添加解决它时,我有同样的问题

buildscript {
     repositories {
    ...
    // You need to add the following repository to download the
    // new plugin.
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
}
 }

from https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#update_gradle

#6


3  

Do you try it

你试试吗

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'

        // NOTE: Do not place your application dependencies here; they belong
    }

}

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

    }

}

and Build->Clear Project

和构建 - >清除项目

#7


1  

Updating CordovaLib -> build.gradle also worked for me, as above. I was looking at the root build.gradle initially which was correct and already included jcenter().

如上所述,更新CordovaLib - > build.gradle也对我有用。我最初看的根build.gradle是正确的,已经包含了jcenter()。

#8


1  

On my side I got the same issue because I used the wrong order of repositories.

在我这边我得到了同样的问题因为我使用了错误的存储库顺序。

google() should be added before jcenter()

应该在jcenter()之前添加google()

buildscript {
    repositories {
        google()
        jcenter()
    }

#9


0  

Change the gradle version as same to android version like Right know we are using 2.3.2 of gradle

将gradle版本更改为与Android版本相同的权利知道我们正在使用2.3.2的gradle

#10


0  

Add jcenter in your project gradle file and sync

在项目gradle文件中添加jcenter并同步

Gradle错误:找不到com.android.tools.build:gradle:2.2.3

#11


0  

The issue is caused by your type of internet connection which prevents or blocks Android Studio from downloading required files from jcenter, this should happen automatically when you build your solution. The solution to your problem is to connect to internet using your personal internet connection such as ADSL Router, rebuild the project and the download of necessary files will happen automatically.

该问题是由您的互联网连接类型导致的,它阻止或阻止Android Studio从jcenter下载所需的文件,这应该在您构建解决方案时自动发生。您的问题的解决方案是使用您的个人互联网连接(如ADSL路由器)连接到互联网,重建项目并自动下载必要的文件。