Error:(23, 0) Gradle DSL method not found: 'google()'

来源:互联网 发布:fpga数据采集系统 编辑:程序博客网 时间:2024/05/17 03:14

在使用glide时,刚开始在gradle中引人库时,用的是https://github.com/bumptech/glide直接复制粘贴过来的,如下所示:

repositories {  mavenCentral()  google()}dependencies {  implementation 'com.github.bumptech.glide:glide:4.4.0'  annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'}

在重建工程时报错,报错如下:

Error:(23, 0) Gradle DSL method not found: ‘google()’
Possible causes:

  • The project ‘CoolWeather’ may be using a version of the Android Gradle plug-in that does not contain the method (e.g. ‘testCompile’ was added in 1.1.0).
    Upgrade plugin to version 2.3.1 and sync project
  • The project ‘CoolWeather’ may be using a version of Gradle that does not contain the method.
    Open Gradle wrapper file
  • The build file may be missing a Gradle plugin.
    Apply Gradle plugin

然后将gradle中配置改为如下所示,问题解决。

repositories {    mavenCentral()    maven {        url 'https://maven.google.com'    }}dependencies {    annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'}