I have no idea how to include kotlinx's serializat...
# kotlin-native
s
I have no idea how to include kotlinx's serialization package in a kotlin-native project. Is someone willing to walk me through it? I did do around 3 hours of search and tinkering around but couldn't get it
a
its as simple as adding a plugin and a library. what seems to not be working?
s
How can I add a library?
I tried
Copy code
dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
}
But get an
Unresolved reference: implementation
error
a
share your whole build.gradle.kts please
s
Here it is. All I did was generate a new Kotlin-native project in Intellij, uncheck the add tests option while generating and added
kotlin("plugin.serialization") version "1.6.10"
to the plugins section and added the dependencies block.
a
Step 1: Remove code block from (13-15) Step 2: Refactor line 37 into
Copy code
val nativeMain by getting {
  dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
  }
}
1
s
Omg thank you. It works now. So, the next thing, if you would like, can you explain (or show me a resource) that explains what's happening. I have minimal experience with Gradle. Basically only use it when Intellij generates it and by adding some dependencies when using Kotlin-JVM. Again, thank you so much. I was so lost for so long and was about to give up.
a
s
Will do, thank you so much
Tbh I joined the Slack not expecting anyone to help that much
a
Feel at home mate. After all, we all love kotin and would love to see it grow. I personally have helped and received a lot of help from this slack. If you know how to ask what you want to ask, you are always going to get help in here
🙏 1
r
Check out https://kotlinlang.org/docs/multiplatform-discover-project.html too, all the sibling multiplatform docs should be helpful
1
s
Thank you. Will check it out as well