When I try to annotate an enum class
or object
with @Parcelize
, it results in the error 'Parcelable' should be a class
, both as an editor hint and as a compile failure. I can @Parcelize
classes just fine, but I can't do things like
@Parcelize object MySingletion : Parcelable
@Parcelize enum class Direction : Parcelable { N, E, W, S }
This happens even though the Kotlin website explicitly states that objects and enums are supported. Is there a way to fix this so that I can @Parcelize
these types of classes? And ideally, is there a solution that doesn't involve manually coding the parceler logic?