I'm using ktor, but think this might be a Gradle/I...
# ktor
j
I'm using ktor, but think this might be a Gradle/IntelliJ question. I have
Copy code
kotlin("plugin.serialization") version "1.5.20"
declared in my
build.gradle.kts
file, and yet I cannot use the
*import* kotlinx.serialization.Serializable
in my code. The "External Libraries" part of the project explorer does not show
Gradle:io.ktor:ktor-serialization:1.6.1
like the example code in https://ktor.io/docs/creating-http-apis.html does when I run that. I'm not sure what I need to do in order to get IntelliJ/Gradle to install the necessary dependencies so I can use them in the code?
Bah, ignore me. My versions were wrong in the
build.gradle.kts
for the dependencies. I was matching the kotlin, not the ktor, versions.
r
You shouldn't be matching the ktor versions either, you need to include the runtime dependency for kotlinx serialization (see https://github.com/Kotlin/kotlinx.serialization#dependency-on-the-json-library). There's two parts to kotlinx serialization: the compiler/gradle plugin, which matches the Kotlin version (and is what you put in the plugins block), and the runtime library, which has it's own version and is a normal maven dependency