If you wish to add a google related dependency to project, need to add google maven first to the top level of the build.gradle
.
First check the current gradle version, in gradle - wrapper - gradle-wrapper.preperties
:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.x.x-all.zip
In top level build.gradle
:
- If version is
4.0
or above, addgoogle()
; - If version is below
4.0
, add"maven { url "https://maven.google.com" }"
;
But be aware, if you use 'google()', you may need to update other components as well, the android studio IDE will tell about that.
May refer here.
allprojects {
repositories {
jcenter()
google()
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
网友评论