Execution failed for task ':app:compileDebugKotlin'. error in Flutter after upgrading to 2.10 version

Viewed 543

I upgraded my flutter version to 2.10 and it is giving me this errror while compiling -

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
e: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/518a28e11257a17211a8fb8a5067b186/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.
e: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/6168eafaded8ddacbc73df91bd758ffe/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: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/6c0671fbb7722afc42898b4178b11de7/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: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/91667e970d35cee0f38e121291f325a1/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: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/af48bf569b5523ddd7a06285f676a1ca/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: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/b560d76b568ab2e29107d94002f1a070/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: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/d0224631d7841d16cd3b5d2fab11c793/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: C:/Users/Hp/.gradle/caches/transforms-2/files-2.1/e0583c70716c2ce3cdb07beee79fcae0/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.

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 14s
┌─ 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                                                                                          │
│ C:\Users\Hp\Desktop\Programming\Flutter\flutter_application_notifications\android\build.gradle: │
│ ext.kotlin_version = '<latest-version>'                                                         │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

And I am being honest here, I never have experienced bug free upgradation in Flutter till now, except when they made little changes. Literally. Can someone tell me why is this happening and please give a solution for the above error.

2 Answers

Just go to: your flutter app\android\build.gradle:

and initialize

ext.kotlin_version = '1.6.10'

That's it

You have to change the ext.kotlin_version in your_flutter_app\android\build.gradle

From

ext.kotlin_version = 'old version'

to

ext.kotlin_version = '1.6.10'

which is the last version.

and you can always see the last version of ext.kotlin_version from the link

https://kotlinlang.org/docs/gradle.html#plugin-and-versions
Related