Android Studio: Could not find com.android.tools.build:gradle:2.0.0-alpha2

Apparently the build tools have been moved from maven to jcenter so you need to change the code from:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
    }
}

to this

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

More details on the changes:

Android Tools Project Site http://tools.android.com/recent

Android Developer Tools community https://plus.google.com/communities/114791428968349268860/stream/7f20992b-7d9a-4309-9d94-6fbe08f0ad6e


In the main build.gradle file, add jcenter() as main repo, just like that :

buildscript {
    repositories {
        jcenter()
    }
    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
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Remove other repositories or make sure jcenter is the first one.


On my side travis build failed with error message "Could not find com.android.tools.build:gradle:3.0.1".

After addeing google() as additional repository the problem was gone.

buildscript {
    repositories {
        jcenter()
        google()

My local build did not fail because i had installed before "com.android.tools.build:gradle:3.0.1" with anddroid-sdk-manager