TouchBoarder / weekdays-buttons-bar

"Weekdays Buttons Bar" is an Android library that makes it easy to integrate weekdays selection in your layout.
MIT License
146 stars 25 forks source link

ClassNotFoundException when unmarshalling: com.touchboarder.weekdaysbuttons.WeekdaysDataItem #13

Open dshatz opened 6 years ago

dshatz commented 6 years ago

On some devices my app started producing the following exception. It happens after a call to my activity's onCreate with savedInstanceState not being null. The following code is called: weekDayPicker = WeekdaysDataSource.restoreState(KEY_WEEK_DAY_PICKER_STATE, savedInstanceState, this, this, this);

Only happens on API level 23.

Using latest version: compile 'com.github.TouchBoarder:weekdays-buttons-bar:v1.0.2'

Any ideas? Exception:

Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dshatz.delayedsender/com.dshatz.delayedsender.activity.NewMessageActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.touchboarder.weekdaysbuttons.WeekdaysDataItem
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2442)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2506)
android.app.ActivityThread.-wrap11 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1363)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:5491)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:728)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)

Caused by android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.touchboarder.weekdaysbuttons.WeekdaysDataItem
android.os.Parcel.readParcelableCreator (Parcel.java:2432)
android.os.Parcel.readParcelable (Parcel.java:2358)
android.os.Parcel.readValue (Parcel.java:2264)
android.os.Parcel.readListInternal (Parcel.java:2655)
android.os.Parcel.readList (Parcel.java:1735)
com.touchboarder.weekdaysbuttons.WeekdaysDataSource.<init> (WeekdaysDataSource.java:829)
com.touchboarder.weekdaysbuttons.WeekdaysDataSource$2.createFromParcel (WeekdaysDataSource.java:860)
com.touchboarder.weekdaysbuttons.WeekdaysDataSource$2.createFromParcel (WeekdaysDataSource.java:858)
android.os.Parcel.readParcelable (Parcel.java:2367)
android.os.Parcel.readValue (Parcel.java:2264)
android.os.Parcel.readArrayMapInternal (Parcel.java:2614)
android.os.BaseBundle.unparcel (BaseBundle.java:221)
android.os.BaseBundle.getBoolean (BaseBundle.java:659)
android.app.Activity.restoreHasCurrentPermissionRequest (Activity.java:6463)
android.app.Activity.performCreate (Activity.java:6269)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1130)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2395)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2506)
android.app.ActivityThread.-wrap11 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1363)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:5491)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:728)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)
TouchBoarder commented 6 years ago

Have you stored anything in:

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mWeekdaysButtons != null) {
        // If the mWeekdaysButtons isn't null, save it's state for restoration in onCreate()
        mWeekdaysButtons.saveState("wds_tag",outState);
    }
}
dshatz commented 6 years ago

Yes, sorry, I am saving the instance in onSaveInstanceState: if(weekDayPicker != null) weekDayPicker.saveState(KEY_WEEK_DAY_PICKER_STATE, outState);