Gradle 插件仅支持 Kotlin Gradle 插件版本 1.3.40 及更高版本将 android studio gradle 从 4.2.2 升级到 7.0.0 时出错

时间:2021-07-30 08:15:07

标签: java android android-studio kotlin gradle

我最近从 4.2.2 升级了我的 Gradle 版本。到 7.0.0。在我升级并出现以下错误之前,Android Studio 运行应用程序运行良好

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher.
The following dependencies do not satisfy the required version:
root project 'MyNewApp' -> androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0-alpha03 -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20

下面是我的项目级grale

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        //classpath 'com.android.tools.build:gradle:4.2.2'

        def nav_version = "2.3.0-alpha03"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"

        classpath 'com.google.gms:google-services:4.3.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我尝试在 buildscript 下添加 ext.kotlin_version = "1.5.0" 但它同样的错误可能是什么问题

1 个答案:

答案 0 :(得分:2)

我将导航版本更改为以下版本,并且成功

def nav_version = "2.3.5"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"