I am a beginner in Kotlin app development. The following error occurs when I tried to build the app:
C:/Users/Lenovo/.gradle/caches/transforms-2/files-2.1/32f0bb3e96b47cf79ece6482359b6ad2/jetified-kotlin-stdlib-jdk7-1.5.0.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.16
Is it about updating the module? Then how to update it?
The binary version of its metadata is 1.6. 0, expected version is 1.1. 15.
Go to Intellij Preferences -> Build, Execution, Deployment -> Kotlin Compiler. Update Language version and Api version to the one you wish. This should be the accepted answer.
You can check the Kotlin version in Tools | Kotlin | Configure Kotlin Plugin Updates. If you have projects created with earlier Kotlin versions, change the Kotlin version in your projects and update kotlinx libraries if necessary – check the recommended versions.
Kotlin 1.6 was released in November 2021. Kotlin 1.7 was released in June 2022, including the alpha version of the new Kotlin K2 compiler.
For someone who is still looking for answer to this, here is the working solution for this problem. In your project level open build.gradle
file, increase the
ext.kotlin_version
from whatever current version that you have like 1.5.0
, to the latest stable version 1.6.0
(Whatever is latest at that time). Thanks
You can get latest version from here:
https://kotlinlang.org/docs/releases.html#release-details
Happened to me when updating from Kotlin 1.4.30
to 1.5.0
. Seems to be some sort of Gradle
caching issue. I was able to resolve it by updating Gradle
from 6.7.1
to 6.9
(or any other version).
Just go to gradle-wrapper.properties
and change this line from
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip
to
distributionUrl=https://services.gradle.org/distributions/gradle-6.9-all.zip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With