Search code examples
androidkotlingradleandroid-gradle-plugingradle-kotlin-dsl

Android Build Failure: Mismatch Between Kotlin 1.9.0 and Compose Compiler Extension 1.4.3


I'm working on an Android project using Jetpack Compose and I have encountered a compatibility issue between Kotlin and Compose. Despite following the compatibility map and adjusting my versions accordingly, I'm still facing the same error. The error message I receive is: This version (1.4.3) of the Compose Compiler requires Kotlin version 1.8.10 but you appear to be using Kotlin version 1.9.0 which is not known to be compatible. My app gradle:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
    buildFeatures {
        compose = true
        viewBinding = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.4.3"
    }

and my project gradle:

plugins {
    id 'com.android.application' version '8.1.2' apply false
    id 'com.android.library' version '8.1.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
}

Solution

  •  composeOptions {
            kotlinCompilerExtensionVersion '1.5.2'
        }
    

    Change the kotlinCompilerExtentionVersion to 1.5.2. For future reference, please check the below link for compatibility version information : https://developer.android.com/jetpack/androidx/releases/compose-kotlin