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

Fabio

08/03/2023, 11:17 AM
I have an expectation for
Parcelable
and
Parcelize
in my KMP module defined like so:
Copy code
expect interface Parcelable

@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
expect annotation class Parcelize()
and fulfilled on Android like so:
Copy code
actual typealias Parcelable = android.os.Parcelable

actual typealias Parcelize = kotlinx.parcelize.Parcelize
This works well at runtime, however classes in the Android module that are themselves annotated with
kotlinx.parcelize.Parcelize
and have properties with types from the KMP module which are Parcelable/Parcelize cause an error to be shown in the IDE:
Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'
Does anyone know of a way to silence or suppress these errors? Or am I doing something wrong?
z

Zsolt.bertalan

08/05/2023, 4:32 PM
Do you use parcelize-darwin from @Arkadii Ivanov? I have exactly the same issue. There is a Limitations section in the project readme, which mentions similar problems with the ios part. I guess the same is true for the Android part.
a

Arkadii Ivanov

08/05/2023, 4:47 PM
This looks like a bug in KMP, however I never experienced it. Seems only specific to KMP + Android (unrelated to iOS/parcelize-darwin).
z

Zsolt.bertalan

08/06/2023, 2:47 PM
Actually I was in the middle of converting my project to KMP, with some Decompose parts still in Android. Once I moved them to commonMain, I was forced to convert parcelable parts to their essenty equivalents, and the 'errors' went away.
K 1
decompose intensifies 1
32 Views