简体   繁体   中英

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.

在此处输入图像描述

在此处输入图像描述

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'
    }
}

It is probably 2 years too late, but for me the solution was adding

allprojects {
repositories {
    jcenter()
    google()
}

at the end of build.gradle file with buildscript

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM