Avatar ·

在 Android Studio 中构建 Flutter 项目时出现错误 "Your project requires a newer version of the Kotlin Gradle plugin"

大家好。我是 Android 开发新手,用 Flutter 编写代码。突然在尝试构建项目(命令 `flutter run`)或只是在 Android Studio 中打开项目的 Android 部分时,出现错误: ``` Your project requires a newer version of the Kotlin Gradle plugin. ``` 我使用的是 Flutter 3.10,Android Studio Giraffe。这是我的 `android/build.gradle`: ```kotlin buildscript { ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:8.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } ``` 以及 `android/app/build.gradle`: ```kotlin android { compileSdkVersion 34 ... } ``` 我更新了 SDK,安装了最新版本的插件,但错误仍然出现。我哪里做错了?如何知道需要哪个版本的 Kotlin 插件?这到底在哪里配置?请帮帮我,项目无法构建。