I am getting a crash with KMP and the Material3 da...
# compose-desktop
v
I am getting a crash with KMP and the Material3 date picker. Pretty easy to replicate - just add
val dpState = rememberDatePickerState()
to any composable function and it will crash during composition - error is
Caused by: java.lang.ClassNotFoundException: kotlinx.datetime.Clock$System
. My project does include
kotlinx.datetime
and I use it elsewhere. The same code works on Android. I can produce different errors by varying the parameters in the call to
rememberDatePickerState()
.
Looks to be resolved by switching the compose.material3 library:
Copy code
//            implementation(compose.material3)
            implementation("org.jetbrains.compose.material3:material3:1.9.0-beta06")
I found this suggestion in a YouTrack comment about an iOS crash with the DatePicker - https://youtrack.jetbrains.com/issue/CMP-8929/IrLinkageError-when-using-Clock.System-kot[…]-datetime-in-Compose-DatePicker-on-iOS?backToIssues=false
o
v
Probably! I was using 0.7.1 in my own code but I guess whatever version of compose.material3 was using was older.
f
either use 0.7.1 alongside with 1.10.1 alpha material3 or use 0.7.1-0.6.x compat
s
You don't need to use 1.10 alpha, the 1.9 beta works. compose 1.9.0 is still using material3 based on 1.3. The change was made in the material3 1.4 branch, which hasn't made it to stable yet. So using the multiplatform 1.9 beta branch for material3 or adding the compat dependency will work.
1