Valar Morghulis Valar Morghulis - 2 months ago 20
Android Question

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
}

Answer

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
}