Quantcast
Channel: Active questions tagged serialization - Stack Overflow
Viewing all articles
Browse latest Browse all 301

How do I add serialization into Kotlin Jet Compose project?

$
0
0

I'm new to Kotlin and IntelliJ overall, and I'm trying to add the serialization libraries into a Jet Compose project, but editing the build.gradle.kts doesn't seem to add them properly.I'm not sure if the versions I'm using aren't compatible or if I'm not adding them correctly, but when I write a data class like this:

import kotlinx.serialization.Serializable@Serializabledata class Cuenta(val id: String, val pagina: String, val email: String, val usuario: String, val cont: String)

it doesn't recognize the library, therefore the @Serializable is also not recognized.

What am I doing wrong and how can I make it work?

Or, if this doesn't work, is there other ways that I can serialize data classes in Kotlin Jet Compose?

Currently my build.gradle looks like this:

import org.jetbrains.compose.desktop.application.dsl.TargetFormatplugins {    kotlin("jvm")    id("org.jetbrains.compose")    kotlin("plugin.serialization") version "1.6.0"}group = "com.example"version = "1.0-SNAPSHOT"repositories {    mavenCentral()    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")    google()}dependencies {    implementation(compose.desktop.currentOs)    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")}compose.desktop {    application {        mainClass = "MainKt"        nativeDistributions {            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)            packageName = "PassGes2"            packageVersion = "1.0.0"        }    }}

Viewing all articles
Browse latest Browse all 301

Latest Images

Trending Articles





Latest Images