bluelinelabs / Conductor

A small, yet full-featured framework that allows building View-based Android applications
Apache License 2.0
3.9k stars 343 forks source link

Crash on Activity restoration with RouterStateAdapter #665

Closed subbota-a closed 2 years ago

subbota-a commented 2 years ago

I use RouterStateAdapter for ViewPager2 from 'com.bluelinelabs:conductor-viewpager2:3.1.3' And it crashes when Activity is restored from savedInstanceState. You can easily reproduce it at the demo on Android API 23

  1. Turn on: Don't keep activities in Developer Options on your Phone
  2. Start the demo app
  3. Open ViewPager2
  4. Collapse the app
  5. Restore the app
  6. it will crash
subbota-a commented 2 years ago
     Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.bluelinelabs.conductor.viewpager2.RouterStateAdapter$SavedState
        at android.os.Parcel.readParcelableCreator(Parcel.java:2411)
        at android.os.Parcel.readParcelable(Parcel.java:2337)
        at androidx.viewpager2.widget.ViewPager2$SavedState.readValues(ViewPager2.java:401)
        at androidx.viewpager2.widget.ViewPager2$SavedState.<init>(ViewPager2.java:391)
        at androidx.viewpager2.widget.ViewPager2$SavedState$1.createFromParcel(ViewPager2.java:415)
        at androidx.viewpager2.widget.ViewPager2$SavedState$1.createFromParcel(ViewPager2.java:412)
        at android.os.Parcel.readParcelable(Parcel.java:2344)
        at android.os.Parcel.readValue(Parcel.java:2243)
        at android.os.Parcel.readSparseArrayInternal(Parcel.java:2653)
        at android.os.Parcel.readSparseArray(Parcel.java:1946)
        at android.os.Parcel.readValue(Parcel.java:2300)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:2592)
        at android.os.BaseBundle.unparcel(BaseBundle.java:221)
        at android.os.Bundle.getBundle(Bundle.java:763)
        at com.bluelinelabs.conductor.Controller.inflate(Controller.java:1087)
        at com.bluelinelabs.conductor.ControllerChangeHandler.executeChange(ControllerChangeHandler.java:195)
        at com.bluelinelabs.conductor.ControllerChangeHandler.executeChange(ControllerChangeHandler.java:159)
        at com.bluelinelabs.conductor.Router.performControllerChange(Router.java:871)
        at com.bluelinelabs.conductor.Router.performControllerChange(Router.java:831)
        at com.bluelinelabs.conductor.Router.rebindIfNeeded(Router.java:568)
        at com.bluelinelabs.conductor.Conductor.attachRouter(Conductor.kt:30)
        at ***MainActivity.onCreate(MainActivity.kt:82)
        at android.app.Activity.performCreate(Activity.java:6237)
EricKuck commented 2 years ago

I'm not able to reproduce this one. Almost sounds more like a bad build than anything else? SavedState is a valid Parcelable.