title: Module 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.16"
body: <p>I am writing a kotlin library for our project. When finished i built an .aar file and sent it to the team. But they have an error as <code>&quot;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&quot;</code> (<strong>core-ktx version of the library was 1.3.2 and kotlin-gradle-plugin version was 1.5.0 at that time</strong>).</p>
  <p>I researched about it and found this thread.
  <a href="https://stackoverflow.com/questions/67448034/module-was-compiled-with-an-incompatible-version-of-kotlin-the-binary-version">&quot;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&quot;</a></p>
  <p>I tried given solutions here but none of this worked so far. Whenever i go below version 1.5 of kotlin-gradle-plugin, i see errors like <code>Runtime JAR files in the classpath have the version 1.4, which is older than the API version 1.5?</code></p>
  <p>I am sharing gradle files here.</p>
  <p>build.gradle(Project):</p>
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  buildscript {
      repositories {
          google()
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:4.2.2'
          classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0&quot;
  //        classpath 'com.google.gms:google-services:4.3.10'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  <p>build.gradle(:app) :</p>
  <pre><code>plugins {
      id 'com.android.application'
      id 'kotlin-android'
  //    id 'com.google.gms.google-services'
  }
  
  android {
      compileSdk 30
  
      defaultConfig {
          applicationId &quot;com.neco.myDemoProject&quot;
          minSdk 21
          targetSdk 30
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      kotlinOptions {
          jvmTarget = '1.8'
      }
  }
  
  dependencies {
  
      implementation 'androidx.core:core-ktx:1.5.0'
      implementation 'androidx.appcompat:appcompat:1.3.1'
      implementation 'com.google.android.material:material:1.4.0'
      implementation 'androidx.annotation:annotation:1.2.0'
      implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
      implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
      implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
      implementation project(path: ':myLibrary')
      implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
      implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
      testImplementation 'junit:junit:4.+'
      androidTestImplementation 'androidx.test.ext:junit:1.1.3'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  
      implementation 'com.google.android.gms:play-services-location:18.0.0'
  }
  </code></pre>
  <p>build.gradle(:myLibrary) :</p>
  <pre><code>plugins {
      id 'com.android.library'
      id 'kotlin-android'
  }
  
  android {
      compileSdk 30
  
      defaultConfig {
          minSdk 21
          targetSdk 30
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
          consumerProguardFiles &quot;consumer-rules.pro&quot;
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      kotlinOptions {
          jvmTarget = '1.8'
      }
  }
  
  dependencies {
  
      implementation 'androidx.core:core-ktx:1.0.2'
      implementation 'androidx.appcompat:appcompat:1.0.0'
  
      testImplementation 'junit:junit:4.+'
      androidTestImplementation 'androidx.test.ext:junit:1.1.3'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  
  //    implementation 'com.google.android.gms:play-services-location:18.0.0'
      implementation 'com.google.code.gson:gson:2.8.6'
  }
  </code></pre>
  <p>And here are the versions of dependencies of our project that i need to implement the library to (they are in a text file so i'm copying from there):</p>
  <pre><code>minSdkVersion: 21
  targetSdkVersion: 30
  compileSdkVersion: 30
  
  appCompatVersion: &quot;1.0.0&quot;
  gradleVersion : &quot;3.3.0&quot;
  kotlinVersion: &quot;1.3.60&quot;
  coreKtxVersion: &quot;1.0.2&quot;
  </code></pre>
  <p>Any suggestions about what to do?</p>