androidgradleandroid-gradle-plugin

Cannot resolve external dependency com.android.tools.build:gradle:4.0.1 because no repositories are defined


I try to open the code set but it's not open. show below error.How to fix it

Cannot resolve external dependency com.android.tools.build:gradle:4.0.1 because no repositories are defined.

enter image description here

enter image description here


Solution

  • In your buildscript block you have to add the repositories also.
    Something like:

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