奇怪,我同事他們都不會出現這個問題,,,,解決也很簡單,但是剛開始可能不知道
在項目的根目錄gradle裏面加上google()就行了,兩個都要加,而且要確保google()在jcenter()上面,,,,,屢試不爽,
完整的
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}