https://kotlinlang.org logo
#gradle
Title
# gradle
n

neerav

02/07/2023, 6:52 AM
Hello is it possible to add
kotlin-parcelize
for Kotlin library/module (not-android) ? Can anyone share how as I am getting error regarding android package. ? Here is my kotlin module
build.gradle.kts
Copy code
plugins {
    id("java-library")
    id("org.jetbrains.kotlin.jvm")
    id("kotlinx-serialization")
    id("kotlin-parcelize")
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
}
e

ephemient

02/07/2023, 7:01 AM
no, the
kotlin-parcelize
plugin is only for Android
how would it even work in a non-Android library? it depends on
kotlin-parcelize-runtime
and classes from Android
n

neerav

02/07/2023, 7:21 AM
@ephemient Thanks for clarifying 🙇
c

Casey Brooks

02/07/2023, 4:19 PM
The Essenty library has experimental support for parcelize in Darwin and JVM targets https://github.com/arkivanov/Essenty#parcelable-and-parcelize. But unless you’re using directly with Decompose, it’s probably best to use a proper serialization library; Parcelable was never meant as a general-purpose serialization technique
233 Views