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

nulldev

10/14/2017, 1:15 AM
Does this library work with Android projects? I get this exception when attempting to serialize anything:
Copy code
kotlin.TypeCastException: null cannot be cast to non-null type kotlinx.serialization.KSerializer<T>
                                                                                   at kotlinx.serialization.SerializationKt.serializer(Serialization.kt:23)
The code generation gradle plugin has been enabled using
apply plugin: 'kotlinx-serialization'
in
app/build.gradle
. The object to be serialized has a
@kotlinx.serialization.Serializable
annotation. Kotlin compiler version is
1.1.51
Am I missing something?
Sorry, I meant the Kotlin compiler version is
1.1.51
s

sandwwraith

10/14/2017, 1:30 AM
can you add more snippets of your code and
build.gradle
?
n

nulldev

10/14/2017, 1:44 AM
Nevermind, actually managed to figure this out. I was erasing the reified type that was being passed to the serialization function as I had wrapped the serialization function in another non-inline function... Thanks for help anyways!
3 Views