parceler: Parcel: unable to marshal value

I keep getting this error even though I haven’t unwrapped anything at the receiver end.

This is my model Movie class : https://github.com/Protino/Fad-Flicks/blob/feature/app/src/main/java/com/calgen/prodek/fadflicks/model/Movie.java

This is how I am wrapping and unwrapping .

        //wrapping
        Intent intent = new Intent(mContext, Test.class);
        intent.putExtra(Intent.EXTRA_TEXT, Parcels.wrap(movie)); // movie object of Movie class
        mContext.startActivity(intent);

        //unwrapping
        Movie movie = Parcels.unwrap(getIntent().getParcelableExtra(Intent.EXTRA_TEXT));

I debugged with android studio debugger and found that it’s reading the values correctly with absolutely no problem but all of a sudden the following error occurs and it crashes.

It occurs even when I’ve not used Parcels.unwrap and Parcels.wrap !

You can check it by building the project yourself - https://github.com/Protino/Fad-Flicks/commit/7c773d1fc40bad3519466d78bbf55f8a98959a33

Note : You need to get API_KEY from https://www.themoviedb.org for real data else configure the fetchData function in DetailActivityFragment to add fake data.

The error log is here : java.lang.RuntimeException: Parcel: unable to marshal value com.calgen.prodek.fadflicks.model.Movie@1ac6930 at android.os.Parcel.writeValue(Parcel.java:1337) at android.os.Parcel.writeList(Parcel.java:711) at android.os.Parcel.writeValue(Parcel.java:1284) at android.os.Parcel.writeArrayMapInternal(Parcel.java:638) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313) at android.os.Bundle.writeToParcel(Bundle.java:1096) at android.os.Parcel.writeBundle(Parcel.java:663) at android.support.v4.app.FragmentState.writeToParcel(Fragment.java:138) at android.os.Parcel.writeTypedArray(Parcel.java:1191) at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:385) at android.os.Parcel.writeParcelable(Parcel.java:1357) at android.os.Parcel.writeValue(Parcel.java:1262) at android.os.Parcel.writeArrayMapInternal(Parcel.java:638) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313) at android.os.Bundle.writeToParcel(Bundle.java:1096) at android.os.Parcel.writeBundle(Parcel.java:663) at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2884) at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3261) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Implementing Serializable kind of defeats the purpose here.

Hello Protino for your error just do one thing Implement your Model class with Serializable eg. class Model implements Serializable thats it. I think you are created a class name Model and you are using it like streaming of data so you need to make it serializable by using normal implementation. If it dosen’t work or you are unable to use it just give me message here i’ll give you detail expalnation