Store icon indicating copy to clipboard operation
Store copied to clipboard

Changes in kotlinx.datetime:0.7.0 break store

Open solcott opened this issue 7 months ago • 1 comments

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.

solcott avatar Jun 25 '25 16:06 solcott

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.

solcott avatar Jun 25 '25 21:06 solcott

Thanks for reporting 👍

matt-ramotar avatar Jul 06 '25 23:07 matt-ramotar

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 avatar Jul 30 '25 12:07 rlebranchu

@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")

solcott avatar Jul 30 '25 17:07 solcott

Thanks for your reply ! It works indeed !

rlebranchu avatar Jul 31 '25 07:07 rlebranchu

We released 5.1.0-alpha07 earlier today. Thanks all

matt-ramotar avatar Sep 20 '25 19:09 matt-ramotar