Android – Could not find com.android.tools.build:gradle:4.0.0

androidbuild.gradlegradle

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME

distributionPath=wrapper/dists

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

zipStoreBase=GRADLE_USER_HOME

zipStorePath=wrapper/dists

gradle-wrapper

// 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.0"

        // 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

}

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

Searched in the following locations:

Best Answer

I struggled in a similar question after upgrading the Android Gradle Plugin Version from 3.3.0 to 4.0.0 of a React Native project as suggested by Android Studio. I followed the answer but it still do not sync correctly.

Finally I run rm -rf node_modules and re-install all the dependencies by npm install. After that I sync again and it sync correctly. I guess that there are some caches in different node modules that are not cleaned properly. I hope if someone encounter similar problem can try and see if my answer fix the problem.