RoundCornerProgressBar: android.os.BadParcelableException: ClassNotFoundException when unmarshalling

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.routeyou.startup/com.routeyou.ui.DownloadRouteActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.akexorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar$SavedState at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3294) at android.app.ActivityThread.access$1000(ActivityThread.java:210) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1704) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Caused by android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.akexorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar$SavedState at android.os.Parcel.readParcelableCreator(Parcel.java:2295) at android.os.Parcel.readParcelable(Parcel.java:2245) at android.view.AbsSavedState.<init>(AbsSavedState.java:57) at android.view.View$BaseSavedState.<init>(View.java:21487) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState.<init>(TextRoundCornerProgressBar.java:318) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState.<init>(TextRoundCornerProgressBar.java:306) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState$1.createFromParcel(TextRoundCornerProgressBar.java:340) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState$1.createFromParcel(TextRoundCornerProgressBar.java:338) at android.os.Parcel.readParcelable(Parcel.java:2252) at android.os.Parcel.readValue(Parcel.java:2152) at android.os.Parcel.readSparseArrayInternal(Parcel.java:2546) at android.os.Parcel.readSparseArray(Parcel.java:1874) at android.os.Parcel.readValue(Parcel.java:2209) at android.os.Parcel.readArrayMapInternal(Parcel.java:2485) at android.os.BaseBundle.unparcel(BaseBundle.java:221) at android.os.Bundle.getSparseParcelableArray(Bundle.java:822) at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2290) at android.app.Activity.onRestoreInstanceState(Activity.java:1170) at android.app.Activity.performRestoreInstanceState(Activity.java:1115) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1190) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3157) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3294) at android.app.ActivityThread.access$1000(ActivityThread.java:210) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1704) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

2.1.1 is out with issue fixed.

Feel free to reopen this issue if it still happen.

For those desperately needing a fix… here’s the dirty one I found 😦 I inlined all BaseRoundCornerProgressBar into the derived class

For example, instead of public class IconRoundCornerProgressBar extends BaseRoundCornerProgressBar you need public class IconRoundCornerProgressBar extends LinearLayout and put all method/properties of BaseRoundCornerProgressBar into IconRoundCornerProgressBar

Find attach a special version… I created a IconTextRoundCornerProgressBar (both Icon and Text features) You can have a look at it here

IconTextRCPB.zip

Hi @akexorcist is this issue fixed ?

Good news everyone. I finally fixed it.

It’s hard to dig up the problem causing. Because there’s no one create custom view with class inheritance like this.

The common solution the save state of custom view doesn’t works with these kind of custom view implementation. To solved this, I replace Creator with Parcelable.ClassLoaderCreator and replace BaseSavedState with AbsSavedState. Those class will support the save state for view hierarchy.

@mehul4795 Your steps description is very helpful. Thank you so much.

See you in v2.1.1.

Hello, @akexorcist

Steps to reproduce the issue

  1. Run the app and navigate to the screen which shows the progress bar.
  2. Put the app in the background
  3. Kill the app using the “Terminates selected Android Application” option from the Android Studio logcat
  4. Reopen the app using the recents screen

A lot of users are facing this issue. It would be helpful if you can solve and provide an update to the library. Thanks in advance 😃