【问题标题】:Gradle error after update: com.android.tools:sdk-common更新后的 Gradle 错误:com.android.tools:sdk-common
【发布时间】:2018-01-13 16:54:25
【问题描述】:

我将 Android Studio 更新到最新版本 (3.1 Canary 8) 并强制将 com.android.tools.build:gradle 更新到版本 3.1.0-alpha08,但同步项目时出现此错误:

Could not find sdk-common.jar (com.android.tools:sdk-common:26.1.0-alpha08).
Searched in the following locations:
    https://maven.google.com/com/android/tools/sdk-common/26.1.0-alpha08/sdk-common-26.1.0-alpha08.jar

我搜索了一圈但没有找到解决方案,有人可以帮我解决这个问题吗?

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0-alpha07'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.2'
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

非常感谢。

更新:这是新的 bukd.gradle(项目):

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0-alpha08'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.2'
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

标签: android android-studio android-gradle-plugin build.gradle android-studio-3.1


【解决方案1】:

为了知识 ;) 我按照官方文档的建议通过在存储库块中的 jcenter() 上方添加 google() 来修复它:developer.android.com/studio/build/index.html

【讨论】:

    【解决方案2】:

    请转到项目 gradle 文件并在 jcenter() 上方添加 google()。

    【讨论】:

    • 这个答案和我的完全一样;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    • 1970-01-01
    • 1970-01-01
    • 2013-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多