Hi all, I'm trying to get a KMP (<kmp.jetbrains.co...
# multiplatform
m
Hi all, I'm trying to get a KMP (kmp.jetbrains.com/#newProject SharedUI Android iOS) to work with JSON but can't figure out how to add the kotlinx.serialization in the gradle libs.version.toml - https://github.com/MichaelJob/bicycles - does anybody have a hint? thx
j
The only row I think youre missing is:
Copy code
kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
🤔 1
m
Copy code
[versions]
ktor = "2.3.8"
kotlinxSerializationVersion = "1.5.1"

[libraries]
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationVersion" }

[plugins]
kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
added it like this - still not able to resolve the imports in the data class bicycle
j
Have you applied the plugin + added dependency and sync?
m
sync for sure - where to add the dependency&plugin is my initial question, as I do not know where and how
j
https://github.com/MichaelJob/bicycles/blob/master/composeApp%2Fbuild.gradle.kts commonMain dependencies here, add implementation (libs.kotlix.serialization) should work if I read all correct.
m
build.gradle.kts4434: Unresolved reference: kotlix
j
Sorry I misspelled on my phone. But you should get autocomplete in Kotlin dsl.
m
oupps, sorry, but stays the same with the "n": build.gradle.kts4434: Unresolved reference: kotlinx
implementation (_libs_.kotlinx.serialization)
ahh, getting closer - will update - thanks!
Copy code
[versions]
kotlinxSerialization = "1.6.3"

[libraries]
kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }

[plugins]
kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
solved - thx again
j
What was the issue? 🙂
m
well, wrong gradle dependency configs...