PS M:login_page_officialfirebase_signinlogin_signin> flutter run
Launching libmain.dart on sdk gphone64 x86 64 in debug mode…
e: C:/Users/ganes/.gradle/caches/transforms-3/8bcc045eb4873c7d7cfabaaf6dc61958/transformed/jetified-play-services-measurement-api-21.5.1-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version
of its metadata is 1.9.0, expected version is 1.7.1.
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:app:compileDebugKotlin’.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details
- 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 2m 59s
Running Gradle task ‘assembleDebug’… 181.7s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update │
│ M:login_page_officialfirebase_signinlogin_signinandroidbuild.gradle:
│ ext.kotlin_version = ” │
└────────────────────────────────────────────────────────────────────
Error: Gradle task assembleDebug failed with exit code 1
help me to clear this error
2
Answers
You need to go to your
android/build.gradle
orandroid/settings.gradle
file, depending on your Flutter project creation, and update the Kotlin version.Make sure to view the link that was given to you by the console: https://kotlinlang.org/docs/releases.html#release-details.
Depending on when you made your Flutter project, there are 2 different answers.
Note
You might have to try different versions of Kotlin to figure out which version works with your project. As of now, I wouldn’t go any higher than
version 1.9.10
as there are known issues with versions that are higher in Flutter.You can find out more here: https://github.com/flutter/flutter/issues/144566.
Flutter project before version
3.16
and haven’t migrated.android/build.gradle
.flutter clean
.Android Studio
and let it do thegradle sync
.build_runners
, re-run them.Flutter created or after version
3.16
.android/settings.gradle
.flutter clean
.Android Studio
and let it do thegradle sync
.build_runners
, re-run them.Want to migrate?
If you need or want to migrate your Flutter gradle, follow the instructions at: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply.
Had the same issue as the question and did the Deprecated imperative apply of Flutter’s Gradle plugins to the flutter project. Now when I try to build android app the following error happens.
My problem now is as per the guidelines (https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply) I have removed the buildscript {} part of android/build.gredle file. So I cannot change the ext.kotlin_version as suggested. What can I do now?