not exactly a multiplatform question, but maybe so...
# multiplatform
j
not exactly a multiplatform question, but maybe someone here can help me; a few weeks ago I said I would start the migration process to remove the java dependencies to my project to eventually migrate to KMP. Im currently replacing retrofit for ktor. we were using java zonedDateTime and Im trying to migrate to kotlin.time.instant , but chat gpt has been making me run around in cirlces. I can't get the serializer to work for my instant. Ive tried update agp, kotlin, etc but it doesnt seem to work. any insights here? at first it complained that I had to mark it as experimental but once i did that
Serializer has not been found for type 'Instant'. To use context serializer as fallback, explicitly annotate type or property with @Contextual
, trying to make sure i don't go down an endless rabbit hole if anyone is using instant and ktor and standard serializable stuff could you share with me your configurations/plugins versions?
z
kotlinx.serialization 1.9.0 added support for
kotlin.time.Instant
(which was previously in a different package, in kotlinx.datetime) https://github.com/Kotlin/kotlinx.serialization/releases/tag/v1.9.0
👀 1
j
Copy code
plugins{
kotlin("plugin.serialization") version "2.2.0"
Copy code
kotlinxSerializationJson = "1.9.0"
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
Copy code
kotlin = "2.2.21"
but still gives me warnings/errors in the ide, im using Android Studio Narwhal 4 Feature
z
Ah, I can reproduce that in Narwhal indeed, on otherwise perfectly working code. Seems like it's an IDE problem, it works fine in stable IntelliJ as well as newer versions of Android Studio (like Otter RC1).
j
ok sorry for wasting your efforts Marton I never thought of checking the IDE instead. 🤦
z
No worries! At least this means the code should still compile and work. And Otter stable should be here soon too.
j
all good, im happy to use any IDE, and this gets me moving forward 😄
is intellij better than android studio?
z
Our goal is to have full KMP support in both, so you can feel free to use either, whichever one you prefer. Development for KMP tooling happens in IntelliJ first and then gets backported to Android Studio, so things tend to arrive to IntelliJ a little faster. The tradeoff is mainly that IntelliJ lags behind Android Studio in supporting the latest AGP versions (because that needs to be merged back in the other direction).
👀 1
✅ 1
thank you color 1