在我的项目中需要用到google()来读取dependencies,见下文:
buildscript {
repositories {
maven{ url '/nexus/content/groups/public/' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
maven{ url '/nexus/content/groups/public/' }
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
其中google()和jcenter()是被墙的,而 /nexus... 并不包括的google() & jcenter(),如果不用它们就会出现:
> root project > :app > Resolve files of classpath
卡住的问题……
阿里提供的镜像包括了Google和Jcenter:
但是如果我这样用:
google(){ url '/repository/google' }
会报错:
Could not find method google() for arguments [build_481dup0nhfy99x57ko80vlobp$_run_closure1$_closure2$_closure5@7388ff6f] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.