【问题标题】:Failed to update the android gradle plugin 3.5.0android gradle 插件 3.5.0 更新失败
【发布时间】:2020-01-12 11:09:57
【问题描述】:
buildscript {
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    //classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
    classpath 'com.google.gms:google-services:4.3.2'
    classpath 'com.google.firebase:firebase-plugins:2.0.0'
    /*classpath 'com.google.gms:google-services:3.2.1'
    classpath 'com.google.firebase:firebase-plugins:1.2.0'*/
    classpath 'com.google.guava:guava:24.1-jre'
  }
}

allprojects {
repositories {
    jcenter()
    mavenCentral()
    flatDir {
        dirs '../libs'
    }
    google()
    maven { url "https://jitpack.io" }
}
tasks.withType(JavaCompile) {
    options.incremental = true
 }
}

错误:未找到 Gradle DSL 方法:'19.0.0()' 可能的原因: 项目“Rightrend-20190527-2051”可能正在使用不包含该方法的 Android Gradle 插件版本(例如,在 1.1.0 中添加了“testCompile”)。 升级插件到 3.5.0 版本并同步项目

项目“Rightrend-20190527-2051”可能正在使用不包含该方法的 Gradle 版本。 打开 Gradle 包装文件

构建文件可能缺少 Gradle 插件。 申请 Gradle 插件

【问题讨论】:

  • 您能否更新您的帖子以包含您的 build.gradle 的内容
  • 你找到答案了吗?

标签: android android-studio android-gradle-plugin


【解决方案1】:

在“类路径”中更改“实现”(更新您的依赖项):

dependencies {
    implementation'com.android.tools.build:gradle:3.5.0'
    //implementation'com.android.tools.build:gradle:3.2.0-alpha09'
    implementation'com.google.gms:google-services:4.3.2'
    implementation'com.google.firebase:firebase-plugins:2.0.0'
    /*implementation'com.google.gms:google-services:3.2.1'
    implementation'com.google.firebase:firebase-plugins:1.2.0'*/
    implementation'com.google.guava:guava:24.1-jre'
  }

【讨论】:

  • 嗨@Andersan,欢迎来到 Stackoverflow!你能详细说明你的答案吗?乍一看,我无法从问题中找到与代码块的区别。谢谢
【解决方案2】:

这是错误的行,因为 Guava 不是 Gradle 插件:

classpath 'com.google.guava:guava:24.1-jre'

【讨论】:

    【解决方案3】:

    我通过将此行添加到 .gradle 文件(应用程序)来修复此错误

    未找到 Gradle DSL 方法:'kapt()' 可能的原因: 项目“Isfahan Metro”可能正在使用不包含该方法的 Android Gradle 插件版本(例如,在 1.1.0 中添加了“testCompile”)。 升级插件到 3.5.3 版本并同步项目

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'kotlin-kapt' // add this
    

    对于您的问题,请查看此链接。

    https://stackoverflow.com/answer

    将 google() 移到上面。

    【讨论】:

      【解决方案4】:

      打开您的 gradle-wrapper.properties 文件,并将 distributionUrl 更新为 https://services.gradle.org/distributions/gradle-5.4.1-all.zip

      【讨论】:

        猜你喜欢
        • 2020-01-14
        • 1970-01-01
        • 2019-03-05
        • 2021-11-17
        • 2016-08-08
        • 1970-01-01
        • 2019-07-18
        • 1970-01-01
        • 2022-07-27
        相关资源
        最近更新 更多