Closed Ynnck123 closed 1 month ago
Hi,
I'm currently trying to reproduce the crash you're experiencing. Could you please provide me with the contents of your build.gradle.kts
file at the Android app level, as well as the versions of AGP and Compose that you're using?
Thanks for your fast response, I built my project upon the Kotlin Multiplatform Wizard Compose Multiplatform template.
In this template there is no dedicated Android build.gradle.kts
file. However, I can provide you my build.gradle.kts
file from the composeApp
folder.
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.ksp)
alias(libs.plugins.jetbrains.kotlin.serialization)
alias(libs.plugins.jetbrains.kotlin.parcelize)
alias(libs.plugins.realm)
}
kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
}
}
sourceSets {
androidMain.dependencies {
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.navigation.compose)
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.immutable)
//// LOGGING ////
implementation(libs.logging.kermit)
//// DB ////
implementation(libs.realm.base)
//// KOIN ////
implementation(project.dependencies.platform(libs.koin.bom))
implementation(libs.koin.core)
implementation(libs.koin.compose)
//// UI ////
implementation(libs.compose.datetime.wheel.picker)
}
commonTest.dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(libs.koin.test)
}
}
}
android {
namespace = "com.myapp"
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 = "com.myapp"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0.0"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
buildFeatures {
compose = true
}
dependencies {
debugImplementation(compose.uiTooling)
}
}
My Gradle version catalog file:
[versions]
agp = "8.2.0"
android-compileSdk = "34"
android-minSdk = "24"
android-targetSdk = "34"
androidx-activityCompose = "1.9.0"
compose-plugin = "1.6.11"
datetimeWheelPicker = "1.0.0"
kermit = "2.0.4"
kotlin = "2.0.0"
kotlinxDatetime = "0.6.0"
lifecycle = "2.8.0"
realm = "2.1.0"
ksp = "2.0.0-1.0.23"
koinBom = "3.5.6"
navigationCompose = "2.8.0-alpha08"
kotlinxSerializationJson = "1.7.1"
kotlinxImmutable = "0.3.7"
[libraries]
compose-datetime-wheel-picker = { module = "io.github.darkokoa:datetime-wheel-picker", version.ref = "datetimeWheelPicker" }
logging-kermit = { module = "co.touchlab:kermit", version.ref = "kermit" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycle" }
androidx-navigation-compose = { group = "org.jetbrains.androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
#kotlinx
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
kotlinx-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxImmutable" }
realm-base = { module = "io.realm.kotlin:library-base", version.ref = "realm" }
# Koin
koin-bom = { group = "io.insert-koin", name = "koin-bom", version.ref = "koinBom" }
koin-core = { group = "io.insert-koin", name = "koin-core" }
koin-compose = { group = "io.insert-koin", name = "koin-compose" }
koin-test = { group = "io.insert-koin", name = "koin-test" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
jetbrains-kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
jetbrains-kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref="kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
realm = { id = "io.realm.kotlin", version.ref = "realm" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
Hi,
You're currently using Compose Navigation v2.8.0-alpha08, which introduced Compose v1.7.0. Unfortunately, compose-datetime-wheel-picker doesn't support Compose v1.7.0 yet.
To address this issue, I recommend:
BTW, I noticed that your project's Android minSdk is set to 24. If you want your app to support devices running Android 8.0 (API 26) you'll need to configure Desugaring. I mentioned here at the end
I will go with option 2 and leave out the time picker until then 😊 And thank you for the hint!
Now, you can try this implementation("io.github.darkokoa:datetime-wheel-picker:1.0.0-compose1.7-alpha01")
Thank you! works like a charm
Hello, I tried to use the
WheelDatePicker
component in my compose multiplatform project, but when I open the respective screen my app crashes with the stacktrace mentioned below.I am using Kotlin 2.0.0
My composable code:
Stacktrace