11

C:/Users/khare/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.0/51736992f422993a1e741051bdf3c12801bc1ca1/kotlin-stdlib-common-1.7.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.7.1, expected version is 1.5.1.

What should I do ? How to fix it ?

Priyanshu Khare
  • 111
  • 1
  • 1
  • 4

6 Answers6

15

in (dependencies) inside build.gradle(project) convert from 1.5.x (x) in my case is (20)

 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"

to 1.7.10

 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"

enter image description here

Ziaad Aboelela
  • 359
  • 2
  • 6
  • If you are using compose then you will need to adjust compose versions as well.Normally with 1.7.10 of kotlin you will use 1.3.1 version of compose. Rest you can check using this link. [link](https://developer.android.com/jetpack/androidx/releases/compose-compiler?gclid=Cj0KCQjwkOqZBhDNARIsAACsbfJ-gwm9EEG_S7fyNRC6QCv9RllloD3_TssX8mTi8YD2GdYfC3HagNoaAhKEEALw_wcB&gclsrc=aw.ds#kts) – Hamid Javed Nov 02 '22 at 20:24
9

Just go to build.gradle(Project:yourProjectName)

Change

plugins {
  ...

  id 'org.jetbrains.kotlin.android' version '1.5.x' apply false

  ...
}

[1.5.x means x version number at your case such as 1.5.1]

To

plugins { 
  ...

  id 'org.jetbrains.kotlin.android' version '1.7.10' apply false

  ...
}

It works at my case..

Md. Enamul Haque
  • 926
  • 8
  • 14
2

This is because of the Kotlin version of your Gradle project.

Please upgrade your Kotlin library version.

For more detail, check the below link.

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

Pemassi
  • 612
  • 1
  • 7
  • 20
1

Here is the solution that tired me for a week. I had the below error: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.5.1.

I did all the necessary things, but the result was disappointing, including: Update Kotlin downgrade Kotlin ... For me, the problem was solved by updating Gradle

0

Change build.gradle (project)

 buildscript {
ext.kotlin_version = '1.7.10'
repositories {
    google()
    mavenCentral()
    maven {
         url 'https://jitpack.io'
    }
}
dependencies {
    classpath 'com.google.gms:google-services:4.3.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
   }
}
plugins {
    id 'com.android.application' version '7.2.2' apply false
    id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Surya Ram
  • 41
  • 3
0

It happened to me when both of the below versions were different.

id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
id 'org.jetbrains.kotlin.jvm' version '1.7.10' apply false

After making them both to 1.7.10 it worked.

Also don't forget to clear the caches and restart Android SAtudio

Bharat Lalwani
  • 1,277
  • 15
  • 17