Reputation: 183
I am receiving the set of error messages copied below when running flutter build apk
on my project in Visual Studio Code. I have carefully reviewed and tried various solutions proposed in StackOverflow, such as the following, but nothing is causing these errors to go away.
(Frankly, the various proposed solutions above are not very specific or demonstrative for a non-expert, so I might not even be implementing them correctly.)
e: C:/Docs/Code/Flutter Projects/EZ-Maaser/build/share_plus/.transforms/dd85171ad23a11b94823b4b8e2fd75da/transformed/out/jars/classes.jar!/META-INF/share_plus_release.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.6.0. e: C:/Docs/Code/Flutter Projects/EZ-Maaser/build/package_info_plus/.transforms/243e4248edc9b04ff40b3a0a3dd40de7/transformed/out/jars/classes.jar!/META-INF/package_info_plus_release.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.6.0. e: C:/Users/Joel/.gradle/caches/transforms-3/da6f769dd2fe62bae500e425de7a6811/transformed/core-1.10.1/jars/classes.jar!/META-INF/core_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/Joel/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib.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.6.0. e: C:/Users/Joel/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.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.9.0, expected version is 1.6.0. e: C:/Users/Joel/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.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.9.0, expected version is 1.6.0. e: C:/Users/Joel/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.9.10/dafaf2c27f27c09220cee312df10917d9a5d97ce/kotlin-stdlib-common-1.9.10.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.9.0, expected version is 1.6.0.
I installed the latest version of Kotlin, 1.9.10, and my /android/build.gradle shows this version correctly:
buildscript {
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
I updated the Android Gradle Plugin and the version shown in Android Studio is 8.1.2
.
My Flutter doctor output is:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.13.6, on Microsoft Windows [Version 10.0.19045.3570], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Community 2017 15.8.1)
X Visual Studio 2019 or later is required.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.83.1)
[√] Connected device (4 available)
[√] Network resources
! Doctor found issues in 1 category.
I don't know what else to try. If you need any additional information from me, please let me know. Please provide specific, clear, step-by-step instructions to solve this problem. I've already wasted many hours trying to fix it. Thank you very much.
Upvotes: 5
Views: 878
Reputation: 51
Try upgrade Gradle from 7.3.0 to 7.4.2. Gradle 7.3.0 seems to have problem with applying the correct kotlin_version. You can upgrade Gradle by opening the Android module in Android Studio. AS should ask you whether you want to upgrade Gradle. Proceed with the selected Gradle upgrade to 7.4.2, or whatever the latest version supported by AS.
Upvotes: 0