1、当我们在SDK的tool里面下载更新时,出现了下面的问题:
解决的方法很简单,在跟项目的build.gradle里面加入google(),比如下面这样:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// 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
}
2、但是
关于as版本过低会出现上面的问题,就是说低版本as没有google()库,会出现这个问题:
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// 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
}
Could not find method google() for arguments [] on repository container.
解决的方法就是把google()换成
maven{url 'https://maven.google.com'}
解决!