https://kotlinlang.org logo
#serialization
Title
# serialization
r

ribesg

06/29/2022, 11:22 AM
What is this?
Copy code
java.lang.VerifyError: class kotlinx.serialization.json.internal.StreamingJsonDecoder overrides final method kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
p

Petter Måhlén

06/29/2022, 11:37 AM
could it be a version mismatch between
kotlinx-serialization-core
and
kotlinx-serialization-json
?
r

ribesg

06/29/2022, 11:39 AM
Maybe. I get this crash in a script which depends on a kmp lib. The kmp lib has this dependency, among others.
Copy code
"commonMainApi"("org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.serialization}")
Maybe explicitly adding the dependency on
core
too can help, I’ll try it
A bad version of
core
could be imported as a transitive dependency of another dependency like ktor or something
That doesn’t seem to work
It started from a version that had a few changes, but one of them is adding dependency to ktor resources plugin so maybe it’s a transitive dependency of that
Copy code
"commonMainApi"("io.ktor:ktor-client-resources:${Versions.ktor}")
I fixed it by adding this
Copy code
"commonMainApi"("org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.serialization}")
and tweaking the dependency on
ktor-client-resources
Copy code
"commonMainApi"("io.ktor:ktor-client-resources:${Versions.ktor}") {
    exclude("org.jetbrains.kotlinx", "kotlinx-serialization-core")
}
👍 1
4 Views