Djuro
01/07/2024, 4:25 PMextesnsions-compose
.
I am creating a KMP project using KMP and compose multiplatform. I use the Jetbrains' official wizard from here
Issue is that as soon as I add extensions-compose
(3.0.0-alpha04) my IDE is unable to resolve kotlinx.coroutines and also some of the compose multiplatform configurations like for example androidx.compose.foundation.layout
Does someone know why this is happening
Here is my .toml
file:
[versions]
buildkonfigGradlePlugin = "latest_version"
compose = "1.5.4"
compose-plugin = "1.5.11"
compose-compiler = "1.5.5"
agp = "8.1.4"
android-minSdk = "24"
android-compileSdk = "34"
android-targetSdk = "34"
androidx-activityCompose = "1.8.1"
androidx-core-ktx = "1.12.0"
androidx-appcompat = "1.6.1"
androidx-material = "1.10.0"
androidx-constraintlayout = "2.1.4"
androidx-test-junit = "1.1.5"
androidx-espresso-core = "3.5.1"
kotlin = "1.9.21"
kotlin-serialization-plugin = "1.9.21"
kotlinx-serialization = "1.6.2"
junit = "4.13.2"
kotlinx-datetime = "0.5.0"
kotlinx-coroutines = "1.7.4"
ktor = "2.3.7"
buildkonfig = "0.15.1"
gradle-buildconfig-plugin = "4.2.0"
kermit = "2.0.2"
mokko-mvvm = "0.16.1"
moko-resources = "0.23.0"
multiplatform-settings = "1.1.1"
decompose = "2.2.2"
decompose-jetbrains = "3.0.0-alpha04"
[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material = { module = "androidx.compose.material:material", version.ref = "compose" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-material = { group = "com.google.android.material", name = "material", version.ref = "androidx-material" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" }
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" }
ktor-client-contentnegotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
ktor-serializationkotlinxjson = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" }
ktor-client-android = { group = "io.ktor", name = "ktor-client-android", version.ref = "ktor" }
ktor-client-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.ref = "ktor" }
ktor-client-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" }
ktor-client-auth = { group = "io.ktor", name = "ktor-client-auth", version.ref = "ktor" }
kotlinx-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
kermit = { group = "co.touchlab", name = "kermit", version.ref = "kermit" }
mokko-mvvm-compose = { group = "dev.icerock.moko", name = "mvvm-compose", version.ref = "mokko-mvvm" }
mokko-mvvm-compose-flow = { group = "dev.icerock.moko", name = "mvvm-flow-compose", version.ref = "mokko-mvvm" }
moko-resources-compose = { group = "dev.icerock.moko", name = "resources-compose", version.ref = "moko-resources" }
moko-resources = { group = "dev.icerock.moko", name = "resources", version.ref = "moko-resources" }
mokoResourcesGradlePlugin = { module = "dev.icerock.moko:resources-generator", version.ref = "moko-resources" }
multiplatform-settings = { group = "com.russhwolf", name = "multiplatform-settings", version.ref = "multiplatform-settings" }
multiplatform-settings-noarg = { group = "com.russhwolf", name = "multiplatform-settings-no-arg", version.ref = "multiplatform-settings" }
decompose = { group = "com.arkivanov.decompose", name = "decompose", version.ref = "decompose" }
decompose-compose = { group = "com.arkivanov.decompose", name = "extensions-compose", version.ref = "decompose-jetbrains" }
[plugins]
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
gradle-buildconfig-plugin = { id = "com.github.gmazzo.buildconfig", version.ref = "gradle-buildconfig-plugin" }
kotlinSerilization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-serialization-plugin" }
[bundles]
ktor = ["ktor.client.core", "ktor.client.contentnegotiation", "ktor.serializationkotlinxjson"]
And here is my `build.gradle.kts`file from composeApp
module
import org.jetbrains.compose.ExperimentalComposeLibrary
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.gradle.buildconfig.plugin)
alias(libs.plugins.kotlinSerilization)
id("dev.icerock.mobile.multiplatform-resources")
}
kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
}
}
sourceSets {
androidMain {
dependencies {
implementation(libs.compose.ui)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.androidx.activity.compose)
implementation(libs.ktor.client.android)
}
dependsOn(commonMain.get())
}
iosMain.dependencies {
implementation(libs.ktor.client.darwin)
}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
@OptIn(ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.kotlinx.datetime)
implementation(libs.bundles.ktor)
implementation(libs.kotlinx.serialization)
implementation(libs.ktor.client.logging)
implementation(libs.ktor.client.auth)
implementation(libs.kermit)
implementation(libs.mokko.mvvm.compose)
implementation(libs.mokko.mvvm.compose.flow)
implementation(libs.moko.resources.compose)
implementation(libs.moko.resources)
implementation(libs.multiplatform.settings)
implementation(libs.multiplatform.settings.noarg)
implementation(libs.decompose)
implementation(libs.decompose.compose)
}
}
}
multiplatformResources {
multiplatformResourcesPackage = "org.example.lunchbreak" // required
iosBaseLocalizationRegion = "en" // optional, default "en"
}
android {
namespace = "org.example.lunchbreak"
compileSdk = libs.versions.android.compileSdk.get().toInt()
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
defaultConfig {
applicationId = "org.example.lunchbreak"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
debugImplementation(libs.compose.ui.tooling)
}
}
buildConfig {
buildConfigField("String", "BASE_URL", "")
}
Arkadii Ivanov
01/07/2024, 4:35 PMDjuro
01/08/2024, 9:59 AMUnresolved reference: coroutines
But running it causes no issuesDjuro
01/08/2024, 10:02 AM