Reza
Reza

Reputation: 81

Could not find com.android.tools.build:gradle:4.1.2

In Android Studio, I get this error when I create a project:

Could not find com.android.tools.build:gradle:4.1.2.

error image

Upvotes: 7

Views: 10685

Answers (1)

S-Sh
S-Sh

Reputation: 3873

Correct your app top-level build.gradle file and include Maven repo to download plugin from:

buildscript {
     repositories {
        google()
        jcenter()
        maven { url "https://maven.google.com" }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://maven.google.com" }
        mavenCentral()
    }
}

Other option, it's possible to use beta version of Android Studio and upgrade to new version of AGP:

classpath 'com.android.tools.build:gradle:7.0.0-alpha07'

Upvotes: 11

Related Questions