https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Andrew K

02/08/2023, 7:53 PM
Hi all. I have a working multiplatform setup that uses kotlin serialization. I'm trying to use
multiplatform-settings
but after installing it, I get the following error:
Copy code
Serializer for class 'MyModel' is not found.
I am using the @Serializable annotation with my data class and everything worked prior to installing the library or when I remove it. Any ideas?
j

jessel

02/08/2023, 7:55 PM
Do you have the serialization plugin setup?
a

Andrew K

02/08/2023, 7:57 PM
Copy code
install(ContentNegotiation) {
        json(Json {
            prettyPrint = true
            isLenient = true
            ignoreUnknownKeys = true
        })
    }
j

jessel

02/08/2023, 7:57 PM
What about in your build.gradle
r

russhwolf

02/08/2023, 8:19 PM
The module you're using shouldn't be pulling in any dependencies other than
androidx.startup
so it's strange that it would have any impact on serialization. What versions of Kotlin and kotlinx-serialization are you using?
Multiplatform Settings 1.0 is built against Kotlin 1.8 so if your on older versions of other stuff then maybe that's causing the issue
a

Andrew K

02/08/2023, 8:21 PM
that's probably it then. Using 1.7.20. I'll give that a try, thanks!
r

russhwolf

02/08/2023, 8:22 PM
1.0.0-RC was built against 1.7.20 if you aren't ready to bump other stuff
a

Andrew K

02/08/2023, 8:23 PM
Ok cool. I'll try that first.
Yep, that was the issue. Using 1.0.0-RC worked. I'll work on bumping kotlin up. Thanks!
4 Views