Android Studio:Gradle 刷新失败 - 找不到 com.android.tools.build:gradle:2.2.0-alpha6 [英] Android Studio: Gradle Refresh Failed - Could not find com.android.tools.build:gradle:2.2.0-alpha6

查看:23
本文介绍了Android Studio:Gradle 刷新失败 - 找不到 com.android.tools.build:gradle:2.2.0-alpha6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从 git 中提取了一个 Android 项目,每当我尝试打开它时,Android Studio 都会给我以下错误;

I've just pulled down an Android project from git, and Android Studio is giving me the following error whenever I attempt to open it;

Error:Could not find com.android.tools.build:gradle:2.2.0-alpha6.
Searched in the following locations:
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar
    https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom
    https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar
Required by:
    newApp_Android:app:unspecified

我已经在本地安装了 Gradle,并通过系统设置了环境路径.

I've installed Gradle locally, and set up environment paths via System.

在项目结构/项目下,使用以下设置;

Under Project Structure/Project, the following setup is in use;

Gradle Version : 2.10
Android Plugin Version : 2.2.0-alpha6
Android Plugin Repository : jcenter
Default Library Repository : jcenter

有人能指出我正确的方向吗?

Could anyone point me in the right direction on this?

推荐答案

这是因为构建过程无法在 Maven 存储库中找到依赖项.在项目级别的 build.gradle 文件中添加 jcenter()ma​​venCentral().

This is because the build process is unable to find the dependency in Maven repository. Add jcenter() along with mavenCentral() in your project level build.gradle file.

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

这篇关于Android Studio:Gradle 刷新失败 - 找不到 com.android.tools.build:gradle:2.2.0-alpha6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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