Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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"

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

screenshot

Is it about updating the module? Then how to update it?

like image 320
Saheel Sapovadia Avatar asked May 08 '21 13:05

Saheel Sapovadia


People also ask

Was compiled with an incompatible version of Kotlin the binary version of its metadata is expected version is?

The binary version of its metadata is 1.6. 0, expected version is 1.1. 15.

How do I update my Kotlin compiler?

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.

How do I find my kotlin version?

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.

What is the latest version of Kotlin?

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.


2 Answers

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

like image 80
Ali Raza Avatar answered Oct 19 '22 16:10

Ali Raza


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

like image 41
Sir Codesalot Avatar answered Oct 19 '22 15:10

Sir Codesalot