How to fix Unmarshalling unknown type code XXX at offset YYY in Android?
There's some rules for write and read parcelables.
1- Be careful about type mismatch. If you write int, don't try to read long etc.
2- Be careful about order of writes and reads. Objects must be at the same sort order when reading and writing.
Both of these can cause "Unmarshalling unknown type code".
It's because of Proguard obfuscation - it processed Parcelable. solution: Proguard causing RuntimeException (Unmarshalling unknown type code) in Parcelable class
If a type of List is added, it should be:
@Override public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeList(this.mList);
and unparcel it using the class type like this:
protected MyClass(Parcel in) { super(in); this.mList = new ArrayList<>(); in.readList(this.mList, MyRequiredClass.class.getClassLoader());