更新后出现Gradle错误:com.android.tools:sdk-common [英] Gradle error after update: com.android.tools:sdk-common

查看:585
本文介绍了更新后出现Gradle错误:com.android.tools:sdk-common的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I updated Android Studio to the last version (3.1 Canary 8) and mandatorily the com.android.tools.build:gradle to version 3.1.0-alpha08, but syncing the project I get this error:

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

我到处搜索但找不到解决方案,有人可以帮我解决这个问题吗?

I searched around but not solution found, can someone help me solve this issue?

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
}


推荐答案

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

For the sake of the knowledge ;) I fixed it by adding google() above jcenter() in the repositories block as suggested by the official documentation: developer.android.com/studio/build/index.html

这篇关于更新后出现Gradle错误:com.android.tools:sdk-common的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆