繁体   English   中英

Android Gradle 插件仅支持 Kotlin Gradle 插件版本 1.5.20 及更高版本。 找不到“位置”的路径

[英]The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. Can't find the path to 'location'

我在为 flutter 项目构建 APK 时遇到了这个错误。

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':location' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

我的 android/build.gradle 文件是

buildscript {
    ext.kotlin_version = '1.7.20'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.0'
        //noinspection DifferentKotlinGradleVersion
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'
    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

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

我找不到需要更改 kotlin-gradle-plugin 版本的位置。 请帮忙。

我尝试更改 ext.kotlin_version 但似乎没有帮助。

尝试使用此命令升级您的 flutter 版本。

  • flutter upgrade

编辑:

Gradle 升级

  • android文件夹打开gradle-wrapper.properties

在此处输入图像描述

  • 您需要用这个替换distributionUrl

https://services.gradle.org/distributions/gradle-7.5-all.zip

在此处输入图像描述

  • 运行flutter clean
  • flutter pub get
  • 然后运行 android 应用程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM