RoundCornerProgressBar icon indicating copy to clipboard operation
RoundCornerProgressBar copied to clipboard

android.os.BadParcelableException: ClassNotFoundException when unmarshalling

Open vsk-pvr opened this issue 9 years ago • 20 comments

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)

vsk-pvr avatar Oct 05 '16 04:10 vsk-pvr

same here . i think we should switch to another view

rafiip avatar Jan 14 '17 01:01 rafiip

anyone found a fix for this?

ManuelGA avatar Jul 13 '17 05:07 ManuelGA

Same problem.

luizfp avatar Aug 02 '17 16:08 luizfp

Same problem. I think i need to looking for an alternative library.

rcaboni avatar Aug 22 '17 17:08 rcaboni

I have the same problem, anyone has a solution??

leof23 avatar Sep 20 '17 13:09 leof23

@leof23 I haven't find any solutions. I'm just slowly switching the use of that view in my project for a new one.

luizfp avatar Sep 20 '17 14:09 luizfp

@luizfp do you know another good alternative for this component?

leof23 avatar Sep 20 '17 14:09 leof23

@leof23 I don't know any alternatives that are so customizable.

I make one myself using something like this:

<LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_marginLeft="@dimen/spacing_small"
  android:layout_marginRight="@dimen/spacing_small"
  android:background="@color/dark_gray"
  android:orientation="horizontal"
  android:padding="1.7dp">

  <ImageView
      android:id="@+id/img_progress"
      android:layout_width="30dp"
      android:layout_height="30dp"
      android:background="@color/blue"
      android:padding="@dimen/spacing_tiny"
      android:src="@drawable/ic_hourglass_white" />

  <LinearLayout
      android:id="@+id/progress"
      android:layout_width="match_parent"
      android:layout_height="30dp"
      android:background="@color/dark_gray" />
</LinearLayout>

It's easy to make your own custom view using this simple layout.

With this approach we don't have much control but this fits my needs. One thing is not so easy to reproduce: radius effect. But I can live without this.

luizfp avatar Sep 20 '17 15:09 luizfp

@akexorcist Please look at this issue, if possible.

randheer-kiwi avatar Sep 21 '17 09:09 randheer-kiwi

any news on this?

giancarlov93 avatar Dec 07 '17 17:12 giancarlov93

My users keep reporting the BadParcelableException but it's not due to unmarshalling

Caused by: android.os.BadParcelableException: 
  at android.os.Parcel.readParcelableCreator (Parcel.java:2536)
  at android.os.Parcel.readParcelable (Parcel.java:2462)
  at android.view.AbsSavedState.<init> (AbsSavedState.java:67)
  at android.view.View$BaseSavedState.<init> (View.java:22764)
  at android.view.View$BaseSavedState.<init> (View.java:22753)
  at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState.<init> (IconRoundCornerProgressBar.java:314)
  at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState.<init> (IconRoundCornerProgressBar.java:297)
  at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState$1.createFromParcel (IconRoundCornerProgressBar.java:346)
  at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState$1.createFromParcel (IconRoundCornerProgressBar.java:344)
  at android.os.Parcel.readParcelable (Parcel.java:2471)
  at android.os.Parcel.readValue (Parcel.java:2365)
  at android.os.Parcel.readSparseArrayInternal (Parcel.java:2813)
  at android.os.Parcel.readSparseArray (Parcel.java:2068)
  at android.os.Parcel.readValue (Parcel.java:2422)
  at android.os.Parcel.readArrayMapInternal (Parcel.java:2732)
  at android.os.BaseBundle.unparcel (BaseBundle.java:269)
  at android.os.Bundle.getSparseParcelableArray (Bundle.java:934)
  at com.android.internal.policy.PhoneWindow.restoreHierarchyState (PhoneWindow.java:2109)
  at android.app.Activity.onRestoreInstanceState (Activity.java:1060)
  at android.app.Activity.performRestoreInstanceState (Activity.java:1015)
  at android.app.Instrumentation.callActivityOnRestoreInstanceState (Instrumentation.java:1178)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2670)

behelit avatar Mar 28 '18 00:03 behelit

I create a very simple Progress Bar sample (not a library) in alternative to this beautiful library with this bad bug. If same one is interested : https://github.com/rcaboni/TestCustomProgress

rcaboni avatar May 12 '18 14:05 rcaboni

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

CedricCarniel avatar Aug 18 '18 19:08 CedricCarniel

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

Great. It is working. Thank you @CedricCarniel . I would like to know, What is the issue ? Why it is working, If we combine the files ?

kaleeswaran14 avatar Sep 20 '18 14:09 kaleeswaran14

Same here

alookin-godaddy avatar May 19 '19 19:05 alookin-godaddy

Hey guy

Sorry for huge issue from my library but I can't reproduce this bug.

It will be great, If anyone can provide more information to reproduce it.

@antonlookinpoynt Can you?

akexorcist avatar Apr 16 '20 16:04 akexorcist

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 :)

mehul4795 avatar May 02 '20 14:05 mehul4795

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.

akexorcist avatar May 07 '20 11:05 akexorcist

2.1.1 is out with issue fixed.

Feel free to reopen this issue if it still happen.

akexorcist avatar May 07 '20 12:05 akexorcist

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)

big1990id avatar Dec 26 '21 18:12 big1990id

Hi @akexorcist is this issue fixed ?

heihitesh avatar Mar 24 '24 09:03 heihitesh