Using compose in a multiplatform project , getting...
# compose
w
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
Copy code
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
    }
}
Slack Conversation
j
You need to use later version of Compose that works with 1.5.31
e.g.
1.0.4
or
1.1.0-alpha06
w
org.jetbrains.compose.runtimeruntime1.0.4 Not found
This is a multiplatform project so the dependencies are from jetbrains
j
is this jetpack compose or compose for desktop you're using?
w
Compose multiplatform
I updated my kotlin plugin to 1.5.31 and then started getting this error , tried downgrading kotlin Gradle plugin to 1.5.21 but it didn't work
j
what version of compose for desktop/web etc are you using?
w
It comes from the jetbrains plugin for compose Which is currently providing 1.0.0-alpha3
j
ok, that doesn't work with Kotlin 1.5.31.....try
1.0.0-alpha4-build398
w
I Replaced the dependencies like this , but I'm still getting the error that compose compilers requires kotlin version 1.5.21
I think I need to change the compiler version for compose , How can I do that in a compose multiplatform project !
j
Might be worth comparing to some of the samples at https://github.com/JetBrains/compose-jb/tree/master/examples
I see at least some of them are using Kotlin 1.5.31
w
Should I downgrade to 1.5.21 , but I deleted the folder inside plugins directory and replaced it with the downloaded plugin from marketplace and restarted intellij and still got this error
I tried downgrading it didn't work
j
I'd recommend perhaps starting with one of the samples linked to above
o
These versions worked for me:
Copy code
plugin.org.jetbrains.compose=1.0.0-alpha4-build362
version.kotlin=1.5.31
👍 1