notifee: Android 13 BadParcelableException: Parcel android.os.Parcel: Unmarshalling unknown type code
We’ve been seeing this a reasonable amount since our app was updated to Notifee 5.5.0 (86 instances across 10 users in the last 8 days), any ideas?
It seems to be happening purely on Android 13. It’s also only happening on various models of Pixel phones but I assume that’s because it’s the only one with Android 13 available so far…
This is on React Native 0.66.3 and our top-level build.gradle contains:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 24
compileSdkVersion = 31
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
dependencies {
// ...
classpath("com.google.gms:google-services:4.3.10")
}
Stack trace (it’s always the same type code and offset):
android.os.BadParcelableException: Parcel android.os.Parcel@21652a5: Unmarshalling unknown type code 1107296256 at offset 217
at android.os.Parcel.readValue(Parcel.java:4658)
at android.os.Parcel.readValue(Parcel.java:4490)
at android.os.Parcel.readLazyValue(Parcel.java:4361)
at android.os.Parcel.readArrayMap(Parcel.java:5208)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:441)
at android.os.BaseBundle.unparcel(BaseBundle.java:313)
at android.os.BaseBundle.unparcel(BaseBundle.java:305)
at android.os.BaseBundle.keySet(BaseBundle.java:737)
at com.facebook.react.bridge.Arguments.fromBundle(Arguments.java:295)
at com.facebook.react.bridge.Arguments.fromBundle(Arguments.java:312)
at com.facebook.react.bridge.Arguments.fromBundle(Arguments.java:312)
at io.invertase.notifee.NotifeeReactUtils.promiseResolver(NotifeeReactUtils.java:71)
at io.invertase.notifee.NotifeeApiModule.lambda$getTriggerNotifications$5(NotifeeApiModule.java:88)
at io.invertase.notifee.-$$Lambda$NotifeeApiModule$PNm3RTDT9NuO15y5400FmZ8sOic.onComplete
at app.notifee.core.c.b(SourceFile:204)
at app.notifee.core.-$$Lambda$wP11Zzh_Q5K2vywg80aCSDBhofU.onComplete
at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.0.1:1)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 41 (23 by maintainers)
We got a Pixel 6a for testing the Android 12 to 13 upgrade.
Before Android 13 upgrade
BadParcelableException
crash withcancelAllNotifications
on app start before calling ~getScheduledNotifications
~getTriggerNotifications
Results after Android 13 upgrade
App 1:
BadParcelableException
as expectedApp 2:
Our conclusion
getScheduledNotifications
with notifications scheduled on Android 12 causes the crash on Android 13We’re about to do a new release - for now, we’ve removed our
getTriggerNotifications
call as a workaround (it was only for debug logging). We’ll at least see if we get any more instances of this error in the new build.Ah sorry, our version in yarn.lock is indeed 5.1.0.
Still having this issue at this date, as a workaround I have implemented a simple hook that cancel scheduled notifications when android 13 is detected for the first time on the app. Here it is in case it can help:
for the utility functions, I am using MMKV and a simple wrapper around notifee:
Tested with the database provided by @JK0N, thank you all for the investigations on this annoying issue.
@liamjones i did that already, i even tried uninstalling app and installing again than schedule notifications again no change. I will debug hope to find any error logs on debug mode.
edit: Android 13: Creating notification with custom led light blocking notification displaying
I realize I did not answer these directly:
The unmarshal/deserialize is required to go across the react-native bridge from Java to Javascript, it is unavoidable, however it is possible at the Android code level to probe it and/or log it prior to hitting the react-native bridge. Sentry likely has ways to log things so it could be possible to do that - unknown - I know crashlytics does have ways to do it at any rate. Requires some native code, but is possible
It is so painful that this only happens on android 12 -> 13 update. The only way to reliably reproduce this will be to have a never-upgraded-to-13 phone, put trigger notifications in while it’s on 12, then update to 13 and DO NOT CANCEL THE NOTIFICATIONS OR UNINSTALL. At that point you’ve got a reliable source of bad data to probe, but if you uninstall the app or cancel the notifications they’ll go poof.
Or I suppose you could find the workmanager database in the device data and pull it out for storage, at which point you could manually copy it in at any time 🤔
Anyway, other than at the native Android level there’s no way to probe this data, and it has to be done post-data-fetch / pre-react-native-bridge
Hello Mike, I am Liam’s colleague, I was trying to reproduce this bug but unfortunately my attempts were unsuccessful, I tried the following:
We are considering getting a device that we can upgrade and downgrade between Android 12 and 13.
FYI we’re still trying to find a way to reproduce this with our app in an emulator based on the app configuration of users who are hitting the issue. No luck so far.
Okay, so we think we know (pending repro)
We need the specific data + Notifee API call to set the trigger notification followed by the getTriggerNotifications call that blows up the repro and then we can all have it under the microscope I think
We are having the same issue in production. We are currently using
5.3.0
version of the library. We tried reproducing this on an emulator but couldn’t. Everything works fine on the emulator. We are seeing a lot of crashes for Pixel users with Android 13. We are actively trying to reproduce the issue.