Just a heads up, this weekend I tried starting a m...
# serialization
i
Just a heads up, this weekend I tried starting a multiplatform project using kotlinx.serialization library and just couldn't figure out how to get it to serialize a response. I kept having the error I show below. I suspect it has something to do with the versions of the libraries I was using. I know that if you're using
Kotlin plugin version 1.3.70
you MUST use
kotlinx.serialization version 0.20.0
because it's NOT backwards compatible. Spent a whole day stuck, finally ended up reverting back to
Kotlin plugin 1.3.61
and
kotlinx.serialization 0.14.0
and it finally worked. Also used
ktor 1.3.1
. Just wondering if anybody has tried using the
kotlinx.serialization
library with
Kotlin 1.3.70
successfully? Here's a GitHub gist: https://gist.github.com/lamvann/d441b2529d4f3b164edc5947401a1e4f
Copy code
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.jetbrains.kotlin.mpp_app_android, PID: 28267
    java.lang.NoSuchFieldError: No field Companion of type Lkotlinx/serialization/json/Json$Companion; in class Lkotlinx/serialization/json/Json; or its superclasses (declaration of 'kotlinx.serialization.json.Json' appears in /data/app/org.jetbrains.kotlin.mpp_app_android-InBSbzMi00a168C538jy0g==/base.apk)
        at io.ktor.client.features.json.serializer.KotlinxSerializer.<init>(KotlinxSerializer.kt:22)
r
Ktor hasn’t yet released a version compatible with the 1.3.70 updates of coroutines and serialization. Need to use the 1.3.61 versions of everything still until the Ktor update comes.
👍 2
👀 2
i
That would explain everything!
r
As usual 🤷‍♂️ Hopefully it should no longer be the case in the distant future
c
@russhwolf wasn't that new version announced yesterday on the slack channel?
r
yeah it’s out now. It wasn’t out last Sunday when I posted that message.
💯 1