android-floating-action-button icon indicating copy to clipboard operation
android-floating-action-button copied to clipboard

RuntimeException on SavedState in Fragment after resuming app from termination

Open ch3m1c opened this issue 10 years ago • 8 comments

Hello!

I have an FloatingActionButton and FloatingActionMenu used in my Fragment (what's driven by ViewPager) after app resuming from termination I get a RuntimeException (crash) Maybe it's my own lifecycle issues but after I removed all parts releated to FAB and FAM I didn't get crash.

java.lang.RuntimeException: Unable to start activity ComponentInfo{co.myapp/co.myapp.BaseActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.getbase.floatingactionbutton.FloatingActionsMenu$SavedState
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5086)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.getbase.floatingactionbutton.FloatingActionsMenu$SavedState
            at android.os.Parcel.readParcelableCreator(Parcel.java:2147)
            at android.os.Parcel.readParcelable(Parcel.java:2097)
            at android.os.Parcel.readValue(Parcel.java:2013)
            at android.os.Parcel.readSparseArrayInternal(Parcel.java:2363)
            at android.os.Parcel.readSparseArray(Parcel.java:1735)
            at android.os.Parcel.readValue(Parcel.java:2070)
            at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
            at android.os.Bundle.unparcel(Bundle.java:249)
            at android.os.Bundle.getBundle(Bundle.java:1184)
            at com.google.android.gms.maps.internal.cs.a(SourceFile:74)
            at com.google.maps.api.android.lib6.c.el.a(Unknown Source)
            at com.google.maps.api.android.lib6.c.ag.a(Unknown Source)
            at com.google.android.gms.maps.internal.aa.onTransact(SourceFile:66)
            at android.os.Binder.transact(Binder.java:361)
            at com.google.android.gms.maps.internal.IMapViewDelegate$a$a.onCreate(Unknown Source)
            at com.google.android.gms.maps.MapView$a.onCreate(Unknown Source)
            at com.google.android.gms.dynamic.a$3.b(Unknown Source)
            at com.google.android.gms.dynamic.a$1.a(Unknown Source)
            at com.google.android.gms.maps.MapView$b.nO(Unknown Source)
            at com.google.android.gms.maps.MapView$b.a(Unknown Source)
            at com.google.android.gms.dynamic.a.a(Unknown Source)
            at com.google.android.gms.dynamic.a.onCreate(Unknown Source)
            at com.google.android.gms.maps.MapView.onCreate(Unknown Source)

And thanks a-lot for awesome library! ;) loving it

ch3m1c avatar Jan 13 '15 22:01 ch3m1c

Do you use support-v4 fragments or regular fragments? If you use support-v4, which version of support lib do you use?

chalup avatar Jan 14 '15 08:01 chalup

I use regular fragments from android.app.FragmentManager + android.support.v4.view.ViewPager

These support libraries are compiled into 'com.android.support:appcompat-v7:21.+' 'com.android.support:support-v13:21.0.+'

ch3m1c avatar Jan 15 '15 22:01 ch3m1c

There is a nasty bug in FragmentManager, that's fixed in latest support-v4 lib, but not in android.app.FragmentManager, even on Lollipop:

https://android-review.googlesource.com/#/c/40760/

There's nothing I can do about this. You're going to face this issue whenever you use any custom View with SavedState implementation, unless you switch to support-v4 fragments.

chalup avatar Jan 17 '15 21:01 chalup

Switched to latest import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter;

Still getting same crash.. :(

Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.getbase.floatingactionbutton.FloatingActionsMenu$SavedState

… but it all seems to be connected with MapView I have in the same fragment.. either I remove MapView or FAB's – no crash.. but when they are both in.. It crashes there, weird!

ch3m1c avatar Jan 18 '15 13:01 ch3m1c

Ok, let's take a closer look. So you have a ViewPager with Fragment with MapView and FAM, is that correct? Which version of Google Play Services do you use? Do you use some non-standard (i.e. non-google) MapView related libraries?

chalup avatar Jan 19 '15 17:01 chalup

So you have a ViewPager with Fragment with MapView and FAM, is that correct? – correct Google Play Services - rev. 22 No non-standard MapView libraries

Here's my list of dependencies

dependencies {
    compile 'com.android.support:appcompat-v7:21.+'
    compile 'com.android.support:support-v4:21.0.+'
    compile 'com.android.support:support-v13:21.0.+'
    compile 'com.android.support:palette-v7:21.0.+'
    compile 'com.google.android.gms:play-services:6.5.+'
    compile 'com.facebook.android:facebook-android-sdk:+'
    compile 'com.squareup.picasso:picasso:2.4.+'
    compile 'com.getbase:floatingactionbutton:1.5.1'
}

ch3m1c avatar Jan 19 '15 18:01 ch3m1c

##I have The Same problem too @chalup , I am using the version of the library suported by @str4d Inside a fragment in wich I use a MapView, I also have the FloatingActionMenu wit 3 Action Buttons

java.lang.RuntimeException: Unable to start activity ComponentInfo{cv.innovationlab.tchomataxi/cv.innovationlab.tchomataxi.MainActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: net.i2p.android.ext.floatingactionbutton.FloatingActionsMenu$SavedState
... (hidden stuff)
Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: net.i2p.android.ext.floatingactionbutton.FloatingActionsMenu$SavedState

Help me please! Thanks in advance

AnaxAndrade avatar May 18 '15 01:05 AnaxAndrade

Same for me. The app crashes with the same error message when I change the language without killing the app. Any help is welcome, I'd like to keep this library..

icodeyou avatar Nov 24 '16 17:11 icodeyou