https://kotlinlang.org logo
Title
w

Waqas Tahir

10/16/2021, 7:58 AM
Using compose in a multiplatform project , getting the error : e: This version (1.1.0-alpha01) of the Compose Compiler requires Kotlin version 1.5.21 but you appear to be using Kotlin version 1.5.31 which is not known to be compatible. Please fix your configuration (or
suppressKotlinVersionCompatibilityCheck
but don't say I didn't warn you!). FAILURE: Build failed with an exception. with this build.gradle file
plugins {
    kotlin("multiplatform")
    id("org.jetbrains.compose") version "1.0.0-alpha3"
    id("com.android.library")
    id("kotlin-android-extensions")
//    id("com.vanniktech.maven.publish")
    id("maven-publish")
}

group = BuildConfig.Info.group
version = BuildConfig.Info.version

android {
    compileSdkVersion(BuildConfig.Android.compileSdkVersion)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdkVersion(BuildConfig.Android.minSdkVersion)
        targetSdkVersion(BuildConfig.Android.targetSdkVersion)
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

kotlin {
    android {
        publishLibraryVariants("release", "debug")
    }
    jvm("desktop") {
        compilations.all {
            kotlinOptions.jvmTarget = "11"
        }
    }
    sourceSets {
        val commonMain by getting {
            dependencies {
                api(compose.runtime)
                api(compose.foundation)
                api(compose.material)
                implementation(project(":core"))
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting
        val androidTest by getting {
            dependencies {
                implementation("junit:junit:4.13.2")
            }
        }
        val desktopMain by getting {
            dependencies {
                api(compose.preview)
            }
        }
        val desktopTest by getting
    }
}
:thread-please: 1
j

Javier

10/16/2021, 8:46 AM
use latest alpha 4 dev build
w

Waqas Tahir

10/16/2021, 9:49 AM
So version Is 1.0.0-alpha4
?
s

Skovisen

10/16/2021, 10:06 AM
The latest dev build version is 1.0.0-alpha4-build398, which also can be found here: https://github.com/jetbrains/compose-jb
1
a

Alexander Kurasov[JB]

10/18/2021, 11:20 AM
You use 1.5.31 kotlin plugin (probably version is defined in different place). You should either switch to lotlin 1.5.21 or to compose 1.0.0-alpha4-build398+ (maybe some earlier versions also support 1.5.31, but 398 does for sure)
w

Waqas Tahir

10/18/2021, 11:35 AM
1.0.0-alpha4-build398 does not
a

Alexander Kurasov[JB]

10/18/2021, 11:36 AM
does not what?
w

Waqas Tahir

10/18/2021, 11:36 AM
Support kotlin 1.5.31
a

Alexander Kurasov[JB]

10/18/2021, 11:39 AM
it does - just run an app on 1.5.31+build398. Probably you have some issue in your build scripts. What is the error message with build398?
w

Waqas Tahir

10/18/2021, 11:40 AM
I don't have the laptop at the moment but I was getting the same error. Build 362 probably supports but I haven't checked that , someone else in the other thread said build 362 support kotlin 1.5.31
I will be testing this as soon as I get the laptop
👍 1
a

Alexander Kurasov[JB]

10/18/2021, 11:47 AM
from compatibility perspective builds are incremental. So if build A supports KotlinB, than any A+ supports KotlinB or higher