Kotlin is a modern cross-platform and general-purpose programming language that is used by many programmers. It is an easy language that is completely compatible with Java. The best part of this language is that it is very easy to learn. When you are in a learning phase, you may encounter many errors. Today, we discuss the “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” error.
No matter how long the error seems, you don’t need to worry as we have the best solutions to help you get rid of the error warning. Let’s check out how this error occurs
How you get “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”?
When running a Kotlin program, you will end up with the error:
caches/transforms-2/files-2.1/4541b0189187e0017d23bbb0afebd16a/jetified-kotlin-stdlib-
common-1.5.0.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.
How to fix the error
The error warning “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” pops up when the Kotlin or Gradle version’s locking mechanism is broken or the version is not updated. Check out the solutions to handle the error warning
Solution 1 – Modify build.gradle
If you are using an old version of Kotlin, you are landed yourself in the error warning. You just need to modify the build.gradle
From
ext.kotlin_version = '1.3.50'
to
ext.kotlin_version = '1.4.32'
or you can have the most recent version that is mostly used.
The next step you need to take is to upgrade the version of Kotlin in Android Studio.
Solution 2 – Update Kotlin Version
You can simply update your Kotlin version from 1.3.61 to 1.5.10 to the error like this:

Solution 3 – Add the code in the Program
You need to make sure you have the following line in your program, and if not, you need to add it
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
into this code:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
With this, you can make the error go away.
Solution 4 – Same Kotlin version and gradle.build
You need to make sure the version of Kotlin of the IDE should be the same as the version you added in the file of gradle.build. In order to check it, you need to go to file, click Settings, choose Plugins, then confirm the Kotlin version in your IDE. Once done, replace the value in ext.kotlin_version like this:
ext.kotlin_version = '1.6.10'
Conclusion
We have highlighted various ways to fix the error “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”. I wish you luck and happy coding!
Reference Source: https://www.fluttercampus.com/guide/219/module-was-compiled-with-an-incompatible-version-of-kotlin/