Android解決Couldnotfindcom.android.tools.build:gradle

凌浩雨發表於2017-08-25

異常

Error:Could not find com.android.tools.build:gradle:2.2.2.
Searched in the following locations:
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.jar
Required by:
    :ListViewAnimations-master:unspecified

解決方法

在專案的根目錄的build.gradle檔案中的buildscript->repositories節點下新增jcenter(),然後更新依賴。


buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }

    dependencies {
        classpath `com.android.tools.build:gradle:2.2.2`
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}


相關文章