Search code examples
androidkotlinandroid-jetpack-composeversion

New compose version 1.4.3 gives a weird error


Okey so when i start a new project with sdk 33 in android studio everything is fine. I go into the gradle of the app and see that the versiuon of compose are not the newest version. If i update them to the newest version though i get an error that says

Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. 

I have no clue why but is the new version of compose to unstable or do i have the wrong jdk i have no clue it just gives me this error trying to switch any version of anything either gives me the same error or a new one... Anyone knows why this happens


Solution

  • If you are using compose version 1.4.3, you should use the latest Kotlin version 1.8.21 and compose compiler version 1.4.7. Please refer to this documentation for compose version compatibility.

    In your project build.gradle file:

    plugins {
        id("org.jetbrains.kotlin.android") version "1.8.21" apply false
    }
    

    In your app build.gradle file:

    android {
        composeOptions {
            kotlinCompilerExtensionVersion = "1.4.7"
        }
    }
    

    You may need to upgrade your Android Grade Plugin and Java version too.