When i run the emulator i get these errors and fix :
e: file:///C:/Users/xunre/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.1.10/d3028429e7151d7a7c1a0d63a4f60eac86a87b91/kotlin-stdlib-2.1.10.jar!/META-INF/kotlin-stdlib.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.8.0.
BUILD FAILED in 21m 7s
Running Gradle task 'assembleRelease'... 1268.7s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin BUILD FAILED in 21m 7s
Running Gradle task 'assembleRelease'... 1268.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 the │
│ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of │
│ C:\flutte projects\unfinished\red_heart\android\settings.gradle. │
│ │
│ Alternatively (if your project was created before Flutter 3.19), update │
│ C:\flutte projects\unfinished\red_heart\android\build.gradle │
│ ext.kotlin_version = '<latest-version>' │
└──────────────────────────────────────────────────────────────────────────────────────────
My android android\settings.gradle(already latest kotlin version "2.1.10"):
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "2.1.10" apply false
}
I have upgraded plugins with Gradle's declarative plugins {} block.
The app is running fine on the emulator and got this error when i did flutter build apk
. This is a project 2 years ago i had to so a lot of fix for it to get running. so my question is when it runs on emulator why build failded?
if jdk version is not compatible with gradle version then it shows error, check with jdk and gradle version.
Here check compatibility, Hope so this will resolve your issue.