- AS版本 4.0.2,默认的bulid.gralde文件如下
// 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.2"
// 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
}
其中,google()
到底是哪个地址?
google()存储库是google的maven存储库的快捷引用。它是在gradle4.x+中引入的。实际使用的存储库URL是 https://dl.google.com/dl/android/maven2/index.html 或者直接 https://maven.google.com。
但是,如果您打算使用google()快捷引用,则需要Gradle 4.x+、Android Studio 3.x+和Android 3.x+的Gradle插件。
https://maven.google.com/web/index.html
对应的网站如下