Thread
#serialization
    Ivann Ruiz

    Ivann Ruiz

    2 years ago
    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
    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)
    russhwolf

    russhwolf

    2 years ago
    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.
    Ivann Ruiz

    Ivann Ruiz

    2 years ago
    That would explain everything!
    r

    ribesg

    2 years ago
    As usual 🤷‍♂️ Hopefully it should no longer be the case in the distant future
    c

    CLOVIS

    2 years ago
    @russhwolf wasn't that new version announced yesterday on the slack channel?
    russhwolf

    russhwolf

    2 years ago
    yeah it’s out now. It wasn’t out last Sunday when I posted that message.