Sourabh
Sourabh

Reputation: 319

Error:Could not find com.android.tools.build:gradle:2.1.0-alpha1

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:

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
}

Upvotes: 2

Views: 13676

Answers (3)

J.Yuechao
J.Yuechao

Reputation: 1

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:

This is my configuration

Upvotes: 0

The Godfather
The Godfather

Reputation: 1

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

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

Upvotes: 0

Miguel Benitez
Miguel Benitez

Reputation: 2322

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:

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

EDIT

Try with this classpath in 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
}

Upvotes: 1

Related Questions