引用:https://www.cnblogs.com/caoxinyu/p/10568462.html
build.gradle 可能有多个,一般在app 节点,默认里面不包含buildscript,
allprojects 这两项。
把这段代码加入 build.gradle (Moudle:app) 尾部:
buildscript {
repositories {
maven{ url = "http://maven.aliyun.com/nexus/content/groups/public/" }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven{ url = "http://maven.aliyun.com/nexus/content/groups/public/" }
google()
jcenter()
}
}