Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AndroidRuntime error: Parcel: unable to marshal value

Tags:

java

android

Your HashMap itself is serializable but is the Bottle class serializable? If not, it will not serialize and will throw errors at runtime. Make the Bottle class implement the java.io.Serializable interface


I was getting this error because my class wasnt Serializable. To make my class serializable I had to add : Serializable at the end of class to make is Serializable. Just like this

class Shirt(val price: Double, val discountedPrice: Double) : Serializable

Make sure to import Serializable like this

import java.io.Serializable