Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom'

Viewed 4333

I got the following problem after updating the Gradle. I was not able to find any solution for it. So please help me to solve the following problem. Thanks in advance...

(PROBLEM-----Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom'. Received status code 406 from server: Not Acceptable)

My build.gradle file...

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

Android Gradle plugin 4.1.0 is not release yet. see on Google's Maven Repository. Try classpath 'com.android.tools.build:gradle:4.1.0-rc02' if you want to use 4.1.0.

you should set build.gradle(project level)

classpath 'com.android.tools.build:gradle:4.0.1'

and in gradle-wrapper.properties file

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

then sync again project.

Related