0

I created a new Android app project with "Empty Composed Activity" in Kotlin. After the project is created when I try/launch the project it gives me the following error:

Can't determine type for tag '<macro name="m3_comp_assist_chip_container_shape">?attr/shapeAppearanceCornerSmall</macro>'

To resolve this issue I followed this post: Can't determine type for tag '<macro name="m3_comp_bottom_app_bar_container_color">?attr/colorSurface</macro>'

First I updated

implementation 'com.google.android.material:material:1.6.0'

in build.gradle file in dependencies section.

After this I launched my application and I got these errors (one of them is here):

C:/Users/ASUS/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.6.1/10f354fdb64868baecd67128560c5a0d6312c495/lifecycle-common-2.6.1.jar!/META-INF/lifecycle-common.kotlin_module: 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.

Error

Now for resolving this error I followed this suggestion: 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, but I am unable to find ext.kotlin_version in my build.gradle file.

So I manually add and rerun program.

Added line of code is:

buildscript {
    ext.kotlin_version = '1.5.20' // <= expected version is 1.5.1
}

After this step I got new errors, which are pointing to the Kotlin version:

enter image description here

C:/Users/ASUS/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.6.1/10f354fdb64868baecd67128560c5a0d6312c495/lifecycle-common-2.6.1.jar!/META-INF/lifecycle-common.kotlin_module: 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.

How I can resolve all these issues in one go, so if I created a new project I should not have these errors again?

I think this error is due to Kotlin version upgrade that is not compatiable with Android Studio library, so how I can downgrade my Kotlin version to the last stable version without affecting other parts of Android Studio?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65

1 Answers1

0

Please check in your project gradle file that your kotlin plugin dependency is is applied with latest version or not

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

or add below plugin in your module gradle file like this:

plugins {
    id ("com.android.application")
    id ("org.jetbrains.kotlin.android")
    kotlin("kapt")
   }