解决方案:
1 在项目根目录中buildscript{}添加 google()仓库,
2 在allprojects { repositories {} }内添加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://oss.sonatype.org/content/repositories/snapshots"
// }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
// classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}