pusher / push-notifications-android

Android SDK for Pusher Beams
https://www.pusher.com/beams
MIT License
21 stars 22 forks source link

JsonEncodingException #84

Closed julioromano closed 5 years ago

julioromano commented 5 years ago

We are receiving a lot of crashes with the stack trace pasted below. The weird thing is that we see such reports only from the Play Console's "ANR & crashes" section but not from within our Crashlytics console.

These crashes seems to have started from version 1.4.3. We're not sure if this error has user visible impact as from our preliminary tests push notifications do arrive to devices.

Hope this helps:

java.lang.RuntimeException: 
  at android.app.ActivityThread.installProvider (ActivityThread.java:6683)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:6225)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6140)
  at android.app.ActivityThread.access$1200 (ActivityThread.java:235)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1768)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:6986)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1445)
Caused by: com.squareup.moshi.JsonEncodingException: 
  at com.squareup.moshi.JsonReader.syntaxError (JsonReader.java:233)
  at com.squareup.moshi.JsonUtf8Reader.checkLenient (JsonUtf8Reader.java:1051)
  at com.squareup.moshi.JsonUtf8Reader.doPeek (JsonUtf8Reader.java:366)
  at com.squareup.moshi.JsonUtf8Reader.peek (JsonUtf8Reader.java:193)
  at com.squareup.moshi.JsonAdapter$2.fromJson (JsonAdapter.java:134)
  at com.squareup.moshi.JsonAdapter.fromJson (JsonAdapter.java:36)
  at com.pusher.pushnotifications.internal.MoshiConverter.from (MoshiConverter.java:14)
  at com.pusher.pushnotifications.internal.TapeJobQueue$noExceptionConverter$1.from (TapeJobQueue.java:22)
  at com.pusher.pushnotifications.internal.TapeJobQueue$noExceptionConverter$1.from (TapeJobQueue.java:19)
  at com.squareup.tape2.FileObjectQueue$QueueFileIterator.next (FileObjectQueue.java:95)
  at kotlin.collections.CollectionsKt___CollectionsKt.filterNotNullTo (CollectionsKt___CollectionsKt.java:730)
  at kotlin.collections.CollectionsKt___CollectionsKt.filterNotNull (CollectionsKt___CollectionsKt.java:723)
  at kotlin.collections.CollectionsKt.filterNotNull (CollectionsKt.java)
  or                     .first (CollectionsKt.java)
  at com.pusher.pushnotifications.internal.TapeJobQueue.asIterable (TapeJobQueue.java:52)
  at com.pusher.pushnotifications.internal.ServerSyncHandler.<init> (ServerSyncHandler.java:39)
  at com.pusher.pushnotifications.internal.ServerSyncHandler.<init> (ServerSyncHandler.java:14)
  at com.pusher.pushnotifications.internal.ServerSyncHandler$Companion.obtain$pushnotifications_release (ServerSyncHandler.java:80)
  at com.pusher.pushnotifications.PushNotificationsInstance$serverSyncHandler$1.invoke (PushNotificationsInstance.java:106)
  at com.pusher.pushnotifications.PushNotificationsInstance$serverSyncHandler$1.invoke (PushNotificationsInstance.java:93)
  at com.pusher.pushnotifications.PushNotificationsInstance.<init> (PushNotificationsInstance.java:105)
  at com.pusher.pushnotifications.internal.PushNotificationsInitProvider.onCreate (PushNotificationsInitProvider.java:67)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:1940)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:1915)
  at android.app.ActivityThread.installProvider (ActivityThread.java:6678)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:6225)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6140)
  at android.app.ActivityThread.access$1200 (ActivityThread.java:235)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1768)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:6986)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1445)
luismfonseca commented 5 years ago

Sorry about this @julioromano!

I did a PR that will solve this issue (#85). These operations are best-effort and so we definitely do not want to crash. I'll release a new version soon.

luismfonseca commented 5 years ago

Please try out version 1.4.4

julioromano commented 5 years ago

@luismfonseca Good! After upgrading to 1.4.4 those crashes stopped showing up. Thanks!