Flutter App crashes with android.os.BadParcelableException

Viewed 37

I created a Flutter application that is used as launcher. The problem I have is, that from time to time the app crashes with this stacktrace:

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3502)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3654)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:85)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2116)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:223)
  at android.app.ActivityThread.main (ActivityThread.java:7720)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:612)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:997)
Caused by: android.os.BadParcelableException: 
  at android.os.Parcel.readParcelableCreator (Parcel.java:3367)
  at android.os.Parcel.readParcelable (Parcel.java:3272)
  at android.os.Parcel.readValue (Parcel.java:3174)
  at android.os.Parcel.readArrayMapInternal (Parcel.java:3567)
  at android.os.BaseBundle.initializeFromParcelLocked (BaseBundle.java:292)
  at android.os.BaseBundle.unparcel (BaseBundle.java:236)
  at android.os.BaseBundle.getBoolean (BaseBundle.java:935)
  at android.app.Activity.restoreHasCurrentPermissionRequest (Activity.java:8297)
  at android.app.Activity.performCreate (Activity.java:7996)
  at android.app.Activity.performCreate (Activity.java:7984)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1309)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3475)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3654)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:85)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2116)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:223)
  at android.app.ActivityThread.main (ActivityThread.java:7720)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:612)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:997)

The crashes are pretty random and I could not find a reliable way to reproduce.

Crashrate from Google Play

I found similar reports:

Anyway I see this errors on Android 11 devices and I'm pretty clueless because:

  • is it an Android issue?
  • is it a Flutter library issue?
  • application misconfiguration?
  • black magic?

I used the last couple of Flutter releases up to the current v3 - all with more or less the same number of crashes. Does anyone can give me an idea what to do next - as I'm pretty clueless at the moment..

1 Answers

I looks like I fixed it. I updated the Flutter runtime everytime but not the project relevant files. This includes like Gradle lib, xml files updates etc. Once I rebuild the project and released it the error went away.

Related