I have encountered with a problem when trying to put value with type Any? into parcel. I'm using @Parcelize from kotlinx.android.parcel. Lint is warning me and hints with message to add @RawValue
, but it's not helping. I got:
android.os.BadParcelableException: ClassNotFoundException when unmarshalling
My data class:
@Parcelize
data class FormulaNode(
val term: @RawValue Any? = null,
val operator: String? = null,
val left: FormulaNode? = null,
val right: FormulaNode? = null) : Parcelable
Any
useParcelable
. – Improbableterm
can be String or FormulaNode at the same time – Cashandcarry@Parcelize
. – Cashandcarry