KotlinNativeSerialization

Please, can someone help me to set up a simple kotlin native project with serialization? I followed steps from

GitHub - Kotlin/kotlinx.serialization: Kotlin multiplatform / multi-format serialization

, but I can’t add a dependency on the serialization runtime library… Source code is here:

I’m struggling with this really long time…

Checked GitHub - sandwwraith/KotlinSerializationPlayground: Sample multiplatform project with kotlinx.serialization as well, but , I can’t make it work.

Thanks!

use build system for native its easy way to build native projects which target windows x86 and 64bit also android and other

Hello, @toni.1! Can you explain a little bit - as I can see from your GitHub repo, you were trying to specify dependencies in a separate block rather than in a sourceSets as it is done here. Have you tried to do things that way? Also, I cannot see enableFeaturePreview('GRADLE_METADATA') = true in your gradle.properties file. Maybe it was causing the problem here.

Thanks! I will try that!

Hi Artyom, now I have JSON serialization, thank you very much! But, I want the output of serialization in byte arrays, not in the string. (I believe that I will get better performance if I’m not using string output serialisation, like JSON). I tried to work with

    implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:0.20.0-1.4-M1-release-99")

            implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:0.20.0-1.4-M1-release-99")

but, it seems in native nothing except JSON is supported…is that true? Should I use other approach regards (kotlin.reflect, maybe?) to get the serialized object in a byte array, like in JVM serialization, or should I wait for a future version of kotlin native…?

dear use gradle build system it is easy to create multi platform project just in one click