As the error says, you need the latest version
of the Kotlin Gradle Plugin.
Fixing the Kotlin Gradle Plugin Version Error
Update Kotlin Version
Open your root build.gradle
file.
Upgrade ext.kotlin_version
to the latest (e.g., 2.1.10
):
ext.kotlin_version = '2.1.10' //as of 24/2/2025
Clean and Reset Gradle
Run:
flutter clean
Delete the android/.gradle
folder.
Update Gradle Version
Open android/gradle/wrapper/gradle-wrapper.properties
.
Update distributionUrl
to a compatible version (e.g., from 5.6.2
to 6.1.1
):
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Rebuild Your Project
Run:
flutter pub get
flutter run
You can also go through these stackoverflow answers for more details.