Software⏱️ 3 min read📅 2026-06-04

How to Fix: AndroidRuntime error: Parcel: unable to marshal value

Learn how to fix: AndroidRuntime error: Parcel: unable to marshal value.

Quick Answer: Try checking your system settings or restarting.

The AndroidRuntime error 'Parcel: unable to marshal value' occurs when trying to pass custom objects, such as your HashMap and Liquor class, to an intent. This issue is common in Android development and can be frustrating to resolve.

This error happens because Android's Parcel class cannot serialize custom classes, including your Liquor class. When you try to pass a HashMap containing your Liquor object to the next activity using Intent.putExtra(), the system is unable to marshal the value, resulting in this runtime error.

💡 Why You Are Getting This Error

  • The primary cause of this issue is that Android's Parcel class does not support serializing custom classes. This limitation prevents you from passing complex objects, like your HashMap containing Liquor instances, as intent extras.
  • Another possible cause could be issues with the serialization process itself or how you are handling the data in your HashMap.

🚀 How to Resolve This Issue

Passing Serializable Objects

  1. Step 1: Replace your custom class (Liquor) with a Serializable implementation. This will allow you to pass instances of your class as intent extras.
  2. Step 2: Make sure that any nested objects within your HashMap are also serializable. If not, consider using a different data structure or implementing serialization for those objects.
  3. Step 3: Use the Parcelable interface to implement custom serialization for your Liquor class if it doesn't already support Serializable.

Using Intent.putBundle() instead of putExtra()

  1. Step 1: If you're passing a HashMap containing multiple values, consider using Intent.putBundle() instead of Intent.putExtra() for each value.
  2. Step 2: This approach allows you to pass complex data structures as intent extras without having to serialize custom classes.
  3. Step 3: However, this method can become cumbersome if dealing with many values or large amounts of data.

🎯 Final Words

To resolve the AndroidRuntime error 'Parcel: unable to marshal value', consider implementing Serializable for your custom class (Liquor) and handling nested objects appropriately. Alternatively, use Intent.putBundle() to pass complex data structures as intent extras.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions