I have the same issue, This is how I setup kotlinx.serialization based on the guide from their github page https://github.com/Kotlin/kotlinx.serialization and the same with here.
From step 1, it is not clear where to put this code
plugins {
kotlin("jvm") version "2.1.20" // or kotlin("multiplatform") or any other kotlin plugin
kotlin("plugin.serialization") version "2.1.20"
}
Then I put it into build.gradle.kts
at project-level, since adding into module-level gives me error.
On step 2, I am adding dependency into my build.gradle.kts
at module-level:
dependencies {
...
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
}
But after I add annotation on my data class it gives me warning.
I am adding the plugin.serialization
into build.gradle.kts
at module-level:
plugins {
...
kotlin("plugin.serialization") // add this
}
Then sync your gradle