我遇到了 Android kotlin 版本的问题。我用过
ext.kotlin_version = '1.7.10'
。但是,它向我显示了这种类型的错误。
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 ':platform_device_id' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
* 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
BUILD FAILED in 8s
Running Gradle task 'assembleDebug'... 9.7s
Exception: Gradle task assembleDebug failed with exit code 1
这是我的
build.gradle
文件:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.13'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
在这个错误中看到[platform_device_id]插件支持android和kotlin版本太慢了。
您可以去pub下载platform_device_id插件,将[Downloads/platform_device_id-1.0.1/android/build中的[ext.kotlin_version = '1.3.50']更改为[ext.kotlin_version = '1.5.20'] .gradle].
下载地址: https://pub.flutter-io.cn/packages/platform_device_id/versions
然后使用path way depandences [platform_device_id]插件,如:
platform_device_id:
path: plugin/platform_device_id
然后将[platform_device_id-1.0.1]移动到项目中的插件文件夹中,并将名称更改为[platform_device_id]。
因此,如果我下载代码并在 Android Studio 中打开它并搜索“kotlin-gradle-plugin”,我可以在“ios/.symlinks/plugins/platform_device_id/android/build.gradle”中找到它
当我将该文件中的 ext.kotlin_version 更改为“1.5.20”时,构建可以正常工作。
我不知道该文件是什么,也不知道如何更改此值,以便我可以在 FlutterFlow 中构建和部署。
来源: