Changes in kotlinx.datetime:0.7.0 break store
kotlinx.datetime:0.7.0 introduced breaking changes that break Store.
kotlinx.datetime.Clock and kotlinx.datetime.Instant were removed in favor of kotlin.time.Clock and kotlin.time.Instant which were introduced in Kotlin 2.1.
I tried to work around this by creating type aliases for each until Store is updated but it's not possible due to the inner class Clock.System. Type aliases for inner classes/objects aren't supported in Kotlin.
It looks like kotlinx-datetime provides a compatibility release 0.7.0-0.6.x-compat that can be used to workaround the issue for now. I'm not sure how long they will continue to release a version that is compatible with older versions.
Thanks for reporting 👍
Hi everyone, I am currently discovering Store version 5.1.0-alpha06. I have just finished implementing the fetcher and now want to test the update.
But I am getting an error:
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/datetime/Clock$System;
at org.mobilenativefoundation.store.store5.StoreWriteRequest$Companion.of$default(StoreWriteRequest.kt:18)
....
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlinx.datetime.Clock$System" on path: DexPathList[[zip file "/data/app/~~meIs-agb_Pgw8wth-aTfCw==/com.sphair.app.androidApp.staging-hn2Yt6k6jog26Ghb0szx7w==/base.apk"],nativeLibraryDirectories=[/data/app/~~meIs-agb_Pgw8wth-aTfCw==/com.sphair.app.androidApp.staging-hn2Yt6k6jog26Ghb0szx7w==/lib/arm64, /data/app/~~meIs-agb_Pgw8wth-aTfCw==/com.sphair.app.androidApp.staging-hn2Yt6k6jog26Ghb0szx7w==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:637)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
Do you know if this is related to this ticket/fix? If so, when will the next version of Store5 be available? If not, can you suggest me ?
(Tests on Android 11 (SDK 30) and Android 16 (SDK 35))
@rlebranchu You need to use the compat version of kotlinx.datetime. The latest version is 0.7.1-0.6.x-compat
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1-0.6.x-compat")
Thanks for your reply ! It works indeed !
We released 5.1.0-alpha07 earlier today. Thanks all