10

solved Could not find com.android.tools.build:gradle:4.0.1 ( or any version )

Error :

Could not find com.android.tools.build:gradle:4.0.1. Searched in the following locations:


build.gradle(Project):

 buildscript {
repositories {
    jcenter()
    google()
}
dependencies {

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

   
}


}



 allprojects {
repositories {
    jcenter()
    maven {
        url 'https://jitpack.io'
    }
    google()
}

}



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

gradle-wrapper.properties

#Mon Jul 27 15:16:19 IRDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

looks like google() and jcenter() are not working as expected.

I just migrated from android studio 2.3.3 to 4.0.1 .

what is my problem???? tell me if you need more information .

thank you for your answer :)

Sadegh J
  • 1,603
  • 2
  • 9
  • 22

1 Answers1

5

Try to put the google() as the first one in the repositories list in the gradle file to solve this issue.

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
Codemaker2015
  • 12,190
  • 6
  • 97
  • 81