必要的 Kotlin 版本
為 Android 平台建置的 Flutter 應用程式 現在需要 Kotlin 1.5.31 或更高版本。
摘要
#要為 Android 建置 Flutter 應用程式,必須使用 Kotlin 1.5.31 或更高版本。
如果你的應用程式使用較低版本, 你將會收到以下錯誤訊息:
┌─ Flutter Fix ────────────────────────────────────────────────────────────┐
│ │
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on │
│ https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update │
│ <path-to-app>/android/build.gradle: │
│ ext.kotlin_version = '<latest-version>' │
│ │
└──────────────────────────────────────────────────────────────────────────┘
背景說明
#Flutter 已在 Android 上新增對 可摺疊裝置 的支援。 這項更新需要在 Flutter embedding 中加入 AndroidX 相依性, 並要求應用程式必須使用 Kotlin 1.5.31 或更高版本。
變更說明
#
現在,為 Android 編譯的 Flutter 應用程式會自動包含 Gradle 相依性
androidx.window:window-java。
遷移指南
#請開啟 <app-src>/android/build.gradle,並修改 ext.kotlin_version:
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.5.31'
時程
#
導入版本:v2.9.0 beta
正式版本:2.10
參考資料
#相關 PR:
Unless stated otherwise, the documentation on this site reflects Flutter 3.44.0. Page last updated on 2026-06-14. View source or report an issue.