Home > Mobile >  The problem occurs after the flutter sdk is updated. How can I fix it?
The problem occurs after the flutter sdk is updated. How can I fix it?

Time:02-11

Launching lib/main.dart on Android SDK built for arm64 in debug mode...
e: /Users/madol.eeee/.gradle/caches/transforms-3/0fbf638dbdf70ad1725fe71b315a2ef4/transformed/jetified-window-1.0.0-beta04-api.jar!/META-INF/window_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/madol.eeee/.gradle/caches/transforms-3/2066b23b9b64ad3895a698a6d1fc8c5f/transformed/jetified-kotlin-stdlib-jdk7-1.5.30.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/madol.eeee/.gradle/caches/transforms-3/2a1bbf32034612557ecc12fcd06b65de/transformed/jetified-kotlin-stdlib-common-1.5.31.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/madol.eeee/.gradle/caches/transforms-3/38348b600f1be8b91fdb7c7730bf1eb5/transformed/jetified-kotlin-stdlib-jdk8-1.5.30.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/madol.eeee/.gradle/caches/transforms-3/5a29260d2a646236c4d0b2d60a4d47d8/transformed/jetified-kotlinx-coroutines-android-1.5.2.jar!/META-INF/kotlinx-coroutines-android.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/madol.eeee/.gradle/caches/transforms-3/74bfffd4e61971b016e3f927bbbd7521/transformed/jetified-kotlin-stdlib-1.5.31.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/madol.eeee/.gradle/caches/transforms-3/7cde7f72a0842ac95e9281eb78688076/transformed/jetified-window-java-1.0.0-beta04-api.jar!/META-INF/window-java_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/madol.eeee/.gradle/caches/transforms-3/e84741d2b04d8859553c8e0a19bf4026/transformed/jetified-kotlinx-coroutines-core-jvm-1.5.2.jar!/META-INF/kotlinx-coroutines-core.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> 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 8s
┌─ 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 /Users/madol.eeee/project/traveling/flutter_traveling/android/build.gradle:           │
│ ext.kotlin_version = '<latest-version>'                                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

i updated flutter sdk version 2.8.1 to 2.10.1 and get error after updated

i don't know why this hapening, how can i fix that?

sorry and thank you

CodePudding user response:

You have to also update your kotlin version, go in file android/build.gradle and change ext.kotlin_version line (should be the second line) to something like this ext.kotlin_version = '1.4.32'

You might also to update your ide (android studios or vscode) and the plugins

CodePudding user response:

first of all i solved this problem with FrancescoPenasa's help thanks!!

the solution is follows,

build.gradle file add follows

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

after add code get another errer like this

Flutter multidex handling is disabled. If you wish to let the tool configure multidex, use the --mutidex flag.

app/build.gradle file add code

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:1.0.3'
}
  • Related