Unmarshalling exception of unknown code type when resuming

I have an application in which I got a tablayout with two fragments, the application works fine, but when I close the application using the menu button and use other applications for a while, and when I resume my application, it crashes with the following exception.

FATAL EXCEPTION: main Process: com.example.com, PID: 5674 java.lang.RuntimeException: cannot start Activity ComponentInfo {com.example.com/com.example.ui.activity.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@9095b3a : Unmarshalling unknown code type 3801188 at offset 4392 at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2426) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2490) at android.app.ActivityThread. -wrap11 (ActivityThread.java) at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1354) on android.os.Handler.dispatchMessage (Handler.java:102) on android.os.Looper.loop (Looper.java:148) at android. app.ActivityThread.main (ActivityThread.java∗443) in java.lang.reflect.Method.invoke (native method) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:728) at com. android.internal.os.ZygoteInit.main (ZygoteInit.java:618) Called: java.lang.RuntimeException: Parcel android.os.Parcel@9095b3a : Unmarshalling unknown code type 3801188 at offset 4392 on android.os.Parcel.readValue (Parcel.java:2340) on android.os.Parcel.readArrayMapInternal (Parcel.java: 2614) on android.os.BaseBundle.unparcel (BaseBundle.java:221) on android.os.Bundle.getSparseParcelableArray (Bundle.java:856) at com.android.internal.policy.PhoneWindow.restoreHierarchyState (PhoneWindow.java:2033 ) at android.app.Activity.onRestoreInstanceState (Activity.java:1008) at android.app.Activity.performRestoreInstanceState (Activity.java:963) at android.app.Instrumentation.callActivityOnRestoreInstanceState (Instrumentation.java:1186) at android.app. ActivityThread.performLaunchActivity (ActivityThread.java:2399) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2490) at android.app.ActivityThread.-wrap11 (ActivityThread.java) at android.app.ActivityThread $ H.handleMessage ( ActivityThread.jav a: 1354) on android.os.Handler.dispatchMessage (Handler.java:102) on android.os.Looper.loop (Looper.java:148) at android.app.ActivityThread.main (ActivityThread.java UP443) in java.lang.reflect.Method.invoke (native method) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java : 618)

I tried disabling proguard and adding the code below but nothing helps

-keepclassmembers class * implements android.os.Parcelable {static ** CREATOR; }

I have a custom view, but it is not implemented in them. I also split everything into fragments and simply saved the view even when it crashed, but when I just downloaded the fragment instance, for example, the new file android.support.v4.app.Fragment (); I did not get an error

+2
android parcelable unmarshalling
source share
2 answers

I ran into the same problem and found a solution to run the application again to stop the crash
In your main business Use:

@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { try { super.onRestoreInstanceState(savedInstanceState); }catch (Exception e){ e.printStackTrace(); Intent intent=new Intent(this,MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } 
+1
source share

This was due to an error in SearchView since appcompat v23.2.0.

This is fixed in v23.2.1. Update your support libraries to get rid of the exception.

+2
source share

All Articles