1

My app is crashing after the process is killed and recreated – with the following exception.

06-15 15:21:15.064 3610-3610/com.example.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.app, PID: 3610
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.ui.module.main.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@17b7cca: Unmarshalling unknown type code 1279544898 at offset 1084
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@17b7cca: Unmarshalling unknown type code 1279544898 at offset 1084
        at android.os.Parcel.readValue(Parcel.java:2824)
        at android.os.Parcel.readSparseArrayInternal(Parcel.java:3195)
        at android.os.Parcel.readSparseArray(Parcel.java:2407)
        at android.os.Parcel.readValue(Parcel.java:2802)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3114)
        at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:273)
        at android.os.BaseBundle.unparcel(BaseBundle.java:226)
        at android.os.Bundle.getSparseParcelableArray(Bundle.java:1009)
        at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2129)
        at android.app.Activity.onRestoreInstanceState(Activity.java:1102)
        at android.app.Activity.performRestoreInstanceState(Activity.java:1057)
        at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1260)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
06-15 15:21:15.065 3610-3610/com.example.app E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.ui.module.main.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@17b7cca: Unmarshalling unknown type code 1279544898 at offset 1084
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@17b7cca: Unmarshalling unknown type code 1279544898 at offset 1084
        at android.os.Parcel.readValue(Parcel.java:2824)
        at android.os.Parcel.readSparseArrayInternal(Parcel.java:3195)
        at android.os.Parcel.readSparseArray(Parcel.java:2407)
        at android.os.Parcel.readValue(Parcel.java:2802)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3114)
        at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:273)
        at android.os.BaseBundle.unparcel(BaseBundle.java:226)
        at android.os.Bundle.getSparseParcelableArray(Bundle.java:1009)
        at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2129)
        at android.app.Activity.onRestoreInstanceState(Activity.java:1102)
        at android.app.Activity.performRestoreInstanceState(Activity.java:1057)
        at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1260)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

I came across this seemingly similar question, with an accepted answer. It points to a Parcelable implementation being obfuscated by ProGuard as the cause, and fixes the issue by adding a ProGuard rule.

I tried adding the aforementioned ProGuard rule to my ProGuard rules, but the crash still occurs. I turned off ProGuard altogether, and the app still crashes.

Even more puzzling is the fact that I actively try to avoid using Parcelable. It is still prevalent in some of the older codebase, but I try to remove it when I can (and implement the new ViewModel structure). The only place I see Parcelable being used in onRestoreInstanceState for a custom Preference class I created; but crash occurs after these methods are successfully called. The stack trace doesn't seem to point to anything, only that the MainActivity is crashing, not even so much as a line number.

Update

The only usage of Parcelable that is referenced from in a class that the MainActivity makes use of is in a custom WallpaperPreference class. This class is used in a Fragment embedded in the MainActivity. I removed this Fragment from the activity, and the crash still occurs.

Bryan
  • 14,756
  • 10
  • 70
  • 125
  • could you share the code where Parcelable is used? – Anatolii Jun 15 '18 at 20:37
  • @user1055395 I enable ProGuard for my debug build as well. It takes a few seconds longer to build but I avoid a lot of issues that way. The issue does occur on release builds as well. – Bryan Jun 15 '18 at 20:41
  • @user1055395 I have, the issue still occurs. As for the code where `Parcelable` appears, I will update my question. – Bryan Jun 15 '18 at 20:46
  • @user1055395 `12.0.1`, haven’t gotten the chance to move over to the newer versions yet. – Bryan Jun 17 '18 at 03:54

0 Answers0