skip to Main Content

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.

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


  1. You need to go to your android/build.gradle or android/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.

    1. Open android/build.gradle.
    2. Update the version.
    3. Run flutter clean.
    4. Open Android Studio and let it do the gradle sync.
    5. If you have any build_runners, re-run them.
    6. Run your build, debug, release, etc. and you shouldn’t see those errors.
    buildscript {
        ext.kotlin_version = '1.9.10' // Update version on this line!
        repositories {
            google()
            mavenCentral()
        }
    

    Flutter created or after version 3.16.

    1. Open android/settings.gradle.
    2. Update the version.
    3. Run flutter clean.
    4. Open Android Studio and let it do the gradle sync.
    5. If you have any build_runners, re-run them.
    6. Run your build, debug, release, etc. and you shouldn’t see those errors.
    plugins {
        id "dev.flutter.flutter-plugin-loader" version "1.0.0"
        id "com.android.application" version '8.3.0' apply false
        id "org.jetbrains.kotlin.android" version "1.9.10" apply false // Update version on this line!
        id "com.google.gms.google-services" version "4.3.15" apply false
        id "com.google.firebase.crashlytics" version "2.8.1" apply false
    }
    

    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.

    Login or Signup to reply.
  2. 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.

    [!] 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 C:UsersSameeraAndroidStudioProjectsskypos_backoffice_mobileandroidbuild.gradle: │
    │ ext.kotlin_version = '<latest-version>' 
    

    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?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search