错误:找不到com.android.tools.build:gradle:2.1.0-alpha1

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

I update my android studio and restart it, it works properly but when i try to imoprt my previous project it shows error somthing like that:

我更新了我的android studio并重新启动它,它运行正常但是当我尝试imoprt之前的项目它显示了错误的东西,比如:

here is the snapshot of error...

这是错误的快照……

Error during import the project

导入项目时出错

and here is my gradle file...

这是我的评分文件……

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

3 个解决方案

#1


1  

Try with other distribution of gradle.

试试其他的等级分布。

Open gradle-wrapper.propertieswhich It's inside gradle/wrapper folder and in distributionUrl set another one which work, for example:

gradle-wrapper开放。属性,它在gradle/wrapper文件夹中,在distributionUrl中,它设置了另一个起作用的属性,例如:

 distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

EDIT

编辑

Try with this classpath in global build.gradle

在global build.gradle中尝试这个类路径。

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

#2


0  

I had the same problem upgrading my Android Studio to 2.2.0. I changed the classpath property of my build.gradle file but the difference with the answers above is that I didn't put the version of the Gradle but the Android Studio's one and it worked. Note that you also need to verify the Ggradle home path in file>>settings>>build,execution,deployment>>gradle

我也有同样的问题,把我的Android Studio升级到2.2.0。我更改了构建的类路径属性。但是与上面的答案不同的是,我并没有把gradle的版本放到Android Studio的版本中,而且它是有效的。注意,您还需要验证文件>>中的Ggradle主路径设置>>构建、执行、部署>>级

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

#3


0  

I had this problem today, and when I updated the Android Plugin Version to the recent one, it worked. So, I think when you meet this problem, you can update the Gradle and Android Plugin Version to the newest. It always works. This is my configuration:

我今天遇到了这个问题,当我把Android的插件版本升级到最近的版本时,它成功了。所以,我认为当你遇到这个问题的时候,你可以更新Gradle和Android的插件版本到最新的。它总是工作。这是我的配置:

错误:找不到com.android.tools.build:gradle:2.1.0-alpha1

#1


1  

Try with other distribution of gradle.

试试其他的等级分布。

Open gradle-wrapper.propertieswhich It's inside gradle/wrapper folder and in distributionUrl set another one which work, for example:

gradle-wrapper开放。属性,它在gradle/wrapper文件夹中,在distributionUrl中,它设置了另一个起作用的属性,例如:

 distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

EDIT

编辑

Try with this classpath in global build.gradle

在global build.gradle中尝试这个类路径。

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

#2


0  

I had the same problem upgrading my Android Studio to 2.2.0. I changed the classpath property of my build.gradle file but the difference with the answers above is that I didn't put the version of the Gradle but the Android Studio's one and it worked. Note that you also need to verify the Ggradle home path in file>>settings>>build,execution,deployment>>gradle

我也有同样的问题,把我的Android Studio升级到2.2.0。我更改了构建的类路径属性。但是与上面的答案不同的是,我并没有把gradle的版本放到Android Studio的版本中,而且它是有效的。注意,您还需要验证文件>>中的Ggradle主路径设置>>构建、执行、部署>>级

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

#3


0  

I had this problem today, and when I updated the Android Plugin Version to the recent one, it worked. So, I think when you meet this problem, you can update the Gradle and Android Plugin Version to the newest. It always works. This is my configuration:

我今天遇到了这个问题,当我把Android的插件版本升级到最近的版本时,它成功了。所以,我认为当你遇到这个问题的时候,你可以更新Gradle和Android的插件版本到最新的。它总是工作。这是我的配置:

错误:找不到com.android.tools.build:gradle:2.1.0-alpha1