说实话这个错报了好久了,由于进行了别的项目开发就一直也没去管他,今天再次打开项目,又见到了熟悉的这个错,于是解决并记录下来。
报错如图
解决办法: 将项目的build.gradle中 buildscript{ ** } allprojects{ ** } 的goodle放到第一位即可 参考配置如下
代码语言:javascript复制// 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:3.1.4'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
// 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" }
maven { url "https://maven.google.com" }
maven { url "https://dl.google.com/dl/android/maven2/"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}