OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
604 stars 368 forks source link

Bad Notification: Couldn't expand RemoteViews for: StatusBarNotification. on Android Nougat #263

Closed jpusp closed 6 years ago

jpusp commented 7 years ago

I'm receiving this issue on crashlytics only on Motorola devices with Android Nougat:

Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package br.com.vivadecora.app: Couldn't expand RemoteViews for: StatusBarNotification(pkg=br.com.vivadecora.app user=UserHandle{0} id=1610499692 tag=null key=0|br.com.vivadecora.app|1610499692|null|10093: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x218 color=0xffcd3128 groupKey=filter vis=PUBLIC))
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6123)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

It works well on all other android versions and manufacturer. I dont have more information besides this log.

Thanks

jkasten2 commented 6 years ago

@sw926 Found the same crash you reported on stackoverflow. https://stackoverflow.com/questions/47257407/securityexception-permission-denial-opening-provider-com-google-android-gms-phe

It is a bug in the GCM / FCM library. Doesn't look like the issue was resolved yet but the comments in that post have a lot of details on the issue.

jkasten2 commented 6 years ago

@dilah Thanks for reporting back. Just to confirm this wasn't trigger from something else, do you have any other code or SDKs in your app?

dilah commented 6 years ago

@jkasten2 yes every time we upload a new version in play store we get those issues the first days. then crash goes away until next release. no new issues related to notifications after this update.

sinhpn92 commented 6 years ago

Oh i have the same crash on device Android 7.0. Have any solution for this issue? I have used FCM 11.4.2

LDALEGRIA commented 6 years ago

@jkasten2 Guys, this issue has been going on for a long time now and we are still not able to get rid of this annoying bug.

Please give us a proper answer to what we should do to provide. If a workaround is needed we are open but ideally, you find the final fix for it.

@andresfabreu is working on from our side.

kirilamenski commented 6 years ago

Hello. I faced with the same issue. I also faced with the same error when I used custom view for NotificationManager via RemoteView. My mistake was that I used direct values of width and height but I solved it by using math_parent in custom view. I don't sure, but I think the problem can be in this file. This link can be useful. @jkasten2 Is it possible to use custom RemoteView instead yours?

Regards!

jkasten2 commented 6 years ago

@LDALEGRIA @andresfabreu Just to confirm, your are not creating any notifications outside of OneSignal when your app is updated? Or using the NotificationExtenderService to change any notifications? Also have you tried my pre-post notification rendering build from Dec 1st in your production app?

We have tried a number of approaches to reproducing this Android bug but none of our attempts have reproduce this crash. We are going to take another pass at both a deeper look into the Android source code as well try some restoring notifications at a slower rate.

As a work around the notification restore feature can be disabled with the following to prevent this crash until we can find a fix. Add following under the <application> tag in your AndroidManifest.xml.

<manifest ...>
    <application ...>
        ...
        <receiver android:name="com.onesignal.UpgradeReceiver" tools:node="remove" />
    </application>
</manifest>
jkasten2 commented 6 years ago

@KirilaMenski The custom remote notification view onesignal_bgimage_notif_layout.xml you linked to is only used if you added a background image. The notifications we have checked so far didn't included a background picture as part of the payload.

If you would like to use a custom notification view you can follow this guide. https://documentation.onesignal.com/docs/android-customizations#section-background-data-and-notification-overriding

whosea commented 6 years ago

FCM to 11.8.0, Support to 27.0.0, oneSignal to 3.6.0 , it also crash on device Android 7.0. 1.no creating any notifications outside of OneSignal 2.no using the NotificationExtenderService to change any notifications 3.it always happened in samsung 7.0 when updated app or new installed app Have been watching for a long time to wait for you to solve this onesignal issue!!!

I think you can use a few Samsung Anndroid7 models, and then update or install the test apk that your upload to play store, go through the complete process

jkasten2 commented 6 years ago

@whosea Thanks for the details about your setup. We will go through the Google Play process to be thorough but only a lower percentage of users are seeing this on a few apps so am not hopeful this will result in reproducing the issue.

jkasten2 commented 6 years ago

I just made a number changes to the notification restoring logic in PR #462. In summary, it restores notifications at a slower rate with less priority to prevents spiking the CPU. If this Android bug is related to a race condition then this should fix or drop the issue to almost zero.

If the changes do not fix this, we will add error tracking which will include a list of notification properties that were restored leading up to the crash. Then we can generate the same notifications, in the same order, which should reproduce the issue. Reproducing is the main obstacle, without it we can't dig in deeper or confirm any future changes would be helpful until then.

PR #462 will be included in the next release and we'll update this thread when it is available.

jkasten2 commented 6 years ago

OneSignal version 3.8.2 is now available with the changes noted above. Please let us know if this fixes your issue or if it has any effect on the number of reports.

zzsdeo commented 6 years ago

I have this crash in my crashlitics dashboard. It appears on Samsung Galaxy A3 running on Android 7.0 I'm using version 3.8.2 in my app

jkasten2 commented 6 years ago

@zzsdeo Can you answer the following so we have more details?

  1. Are you creating any notifications outside of OneSignal in your app? Including any other SDKs
  2. Are you using the NotificationExtenderService?
  3. Did you have OneSignal in the last version of your app? If so, is ratio of effected users less than the last version of the SK?
  4. Could you share your crashlitics link here or with OneSignal support?

Thanks!

zzsdeo commented 6 years ago

@jkasten2

  1. No
  2. Yes
  3. I'm using OneSignal for about 1 year and I did not get these crashes before update to version 3.8.2 This bug affected only one user so far.
  4. I cannot figure out how to share the crash in Firebase Crashlitics. It has not share button like in old dashboard (fabric.io). I paste stack trace right here.
Stacktrace of all threads

``` Fatal Exception: android.app.RemoteServiceException Bad notification posted from package top.shoppinglist.shared: Couldn't expand RemoteViews for: StatusBarNotification(pkg=top.shoppinglist.shared user=UserHandle{0} id=-281654288 tag=null key=0|top.shoppinglist.shared|-281654288|null|10194: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x218 color=0x00000000 groupKey=SSL_notifications vis=PUBLIC semFlags=0x0 semPriority=0)) ``` ```java android.app.ActivityThread$H.handleMessage (ActivityThread.java:1813) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loop (Looper.java:154) arrow_right android.app.ActivityThread.main (ActivityThread.java:6776) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408) Сбой: main #1 android.app.ActivityThread$H.handleMessage (ActivityThread.java:1813) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loop (Looper.java:154) android.app.ActivityThread.main (ActivityThread.java:6776) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408) ONESIGNAL_EXECUTOR_6058 #2 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) pool-2-thread-1 #3 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.LinkedBlockingQueue.take (LinkedBlockingQueue.java:413) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6077 #4 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6064 #5 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Queue #6 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) pool-4-thread-1 #7 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Measurement Worker #8 java.lang.Object.wait (Object.java) java.lang.Object.wait (Object.java:407) com.google.android.gms.internal.zzcil.run (Unknown Source) IntentService[NotificationRestoreService] #9 java.lang.Thread.sleep (Thread.java) java.lang.Thread.sleep (Thread.java:371) java.lang.Thread.sleep (Thread.java:313) com.onesignal.OSUtils.sleep (OSUtils.java:290) com.onesignal.NotificationRestorer.showNotifications (NotificationRestorer.java:219) com.onesignal.NotificationRestorer.restore (NotificationRestorer.java:147) com.onesignal.NotificationRestoreService.onHandleIntent (NotificationRestoreService.java:43) android.app.IntentService$ServiceHandler.handleMessage (IntentService.java:67) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loop (Looper.java:154) android.os.HandlerThread.run (HandlerThread.java:61) FocusHandlerThread #10 android.os.MessageQueue.nativePollOnce (MessageQueue.java) android.os.MessageQueue.next (MessageQueue.java:323) android.os.Looper.loop (Looper.java:136) android.os.HandlerThread.run (HandlerThread.java:61) ONESIGNAL_EXECUTOR_6081 #11 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6065 #12 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) FinalizerDaemon #13 java.lang.Object.wait (Object.java) java.lang.Object.wait (Object.java:407) java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:188) java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:209) java.lang.Daemons$FinalizerDaemon.run (Daemons.java:204) java.lang.Thread.run (Thread.java:762) GoogleApiHandler #14 android.os.MessageQueue.nativePollOnce (MessageQueue.java) android.os.MessageQueue.next (MessageQueue.java:323) android.os.Looper.loop (Looper.java:136) android.os.HandlerThread.run (HandlerThread.java:61) pool-5-thread-1 #15 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:201) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:2077) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1103) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) TokenRefresher #16 android.os.MessageQueue.nativePollOnce (MessageQueue.java) android.os.MessageQueue.next (MessageQueue.java:323) android.os.Looper.loop (Looper.java:136) android.os.HandlerThread.run (HandlerThread.java:61) HeapTaskDaemon #17 dalvik.system.VMRuntime.runHeapTasks (VMRuntime.java) java.lang.Daemons$HeapTaskDaemon.run (Daemons.java:433) java.lang.Thread.run (Thread.java:762) Okio Watchdog #18 java.lang.Object.wait (Object.java) com.android.okhttp.okio.AsyncTimeout.awaitTimeout (AsyncTimeout.java:323) com.android.okhttp.okio.AsyncTimeout.-wrap0 (AsyncTimeout.java) com.android.okhttp.okio.AsyncTimeout$Watchdog.run (AsyncTimeout.java:286) Queue #19 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Crashlytics Exception Handler1 #20 dalvik.system.VMStack.getThreadStackTrace (VMStack.java) java.lang.Thread.getStackTrace (Thread.java:1567) java.lang.Thread.getAllStackTraces (Thread.java:1617) com.crashlytics.android.core.CrashlyticsController.writeSessionEvent (CrashlyticsController.java:1334) com.crashlytics.android.core.CrashlyticsController.writeFatal (CrashlyticsController.java:1021) com.crashlytics.android.core.CrashlyticsController.access$400 (CrashlyticsController.java:68) com.crashlytics.android.core.CrashlyticsController$7.call (CrashlyticsController.java:327) com.crashlytics.android.core.CrashlyticsController$7.call (CrashlyticsController.java:320) java.util.concurrent.FutureTask.run (FutureTask.java:237) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun (ExecutorUtils.java:75) io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run (BackgroundPriorityRunnable.java:30) java.lang.Thread.run (Thread.java:762) Queue #21 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ReferenceQueueDaemon #22 java.lang.Object.wait (Object.java) java.lang.Daemons$ReferenceQueueDaemon.run (Daemons.java:150) java.lang.Thread.run (Thread.java:762) Answers Events Handler1 #23 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:201) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:2077) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1103) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun (ExecutorUtils.java:75) io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run (BackgroundPriorityRunnable.java:30) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6078 #24 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6062 #25 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6073 #26 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Queue #27 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) OSH_NetworkHandlerThread #28 android.os.MessageQueue.nativePollOnce (MessageQueue.java) android.os.MessageQueue.next (MessageQueue.java:323) android.os.Looper.loop (Looper.java:136) android.os.HandlerThread.run (HandlerThread.java:61) OkHttp ConnectionPool #29 java.lang.Object.wait (Object.java) com.android.okhttp.ConnectionPool.performCleanup (ConnectionPool.java:319) com.android.okhttp.ConnectionPool.runCleanupUntilPoolIsEmpty (ConnectionPool.java:256) com.android.okhttp.ConnectionPool.-wrap0 (ConnectionPool.java) com.android.okhttp.ConnectionPool$1.run (ConnectionPool.java:102) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Queue #30 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Queue #31 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) FinalizerWatchdogDaemon #32 java.lang.Thread.sleep (Thread.java) java.lang.Thread.sleep (Thread.java:371) java.lang.Thread.sleep (Thread.java:313) java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor (Daemons.java:314) java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization (Daemons.java:336) java.lang.Daemons$FinalizerWatchdogDaemon.run (Daemons.java:253) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6082 #33 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Queue #34 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ONESIGNAL_EXECUTOR_6083 #35 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1091) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) AsyncTask #1 #36 java.lang.Thread.sleep (Thread.java) java.lang.Thread.sleep (Thread.java:371) java.lang.Thread.sleep (Thread.java:313) com.onesignal.OSUtils.sleep (OSUtils.java:290) com.onesignal.NotificationExtenderService.onNotificationProcessing (NotificationExtenderService.java:207) com.onesignal.NotificationExtenderService.processIntent (NotificationExtenderService.java:155) com.onesignal.NotificationExtenderService.onNotificationProcessing (NotificationExtenderService.java:123) com.onesignal.JobIntentService$CommandProcessor.doInBackground (JobIntentService.java:386) com.onesignal.JobIntentService$CommandProcessor.doInBackground (JobIntentService.java:377) android.os.AsyncTask$2.call (AsyncTask.java:304) java.util.concurrent.FutureTask.run (FutureTask.java:237) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Queue #37 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) Queue #38 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.park (LockSupport.java:161) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2035) java.util.concurrent.PriorityBlockingQueue.take (PriorityBlockingQueue.java:519) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation (DependencyPriorityBlockingQueue.java:197) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get (DependencyPriorityBlockingQueue.java:236) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:65) io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take (DependencyPriorityBlockingQueue.java:46) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) FirebaseDatabaseWorker #39 java.lang.Object.wait (Object.java) java.lang.Thread.parkFor$ (Thread.java:2128) sun.misc.Unsafe.park (Unsafe.java:325) java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:201) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:2077) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1103) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:1084) java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:1058) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1118) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) java.lang.Thread.run (Thread.java:762) ```

jkasten2 commented 6 years ago

@zzsdeo Thanks, few more questions

  1. When did you last release an update for your app?
  2. What version of the OneSignal SDK were you using before?
  3. Did you recently start adding any images to your notifications?
  4. Can you contact OneSignal support linking them this issue so they can review the notifications you sent for any settings that could be related.
zzsdeo commented 6 years ago

@jkasten2

  1. 17 March
  2. 3.8.1 and many older versions. I timely update the SDK.
  3. No, I didn't. I'm using only text notifications.
  4. OK, I'll contact with them.
GrahamBorland commented 6 years ago

~Has anyone figured out if the crash occurs immediately after the app update is installed (when the system redisplays the persistent notification) or only after the app is launched?~

Looks like notifications are not automatically restored by the system, which is what I initially thought. Must be app code causing them to be redisplayed which triggers the crash.

GrahamBorland commented 6 years ago

I'm not using OneSignal, but I'm posting here since I'm experiencing exactly the same issue with notifications in my app, and this issue contains the most useful analysis of the problem.

In my case, I have no custom views; just plain text notifications with small icon. I've tried the following workarounds:

  1. NotificationManager.cancelAll() on first run of a new app version, before later attempting to redisplay notifications.
  2. Started using a unique PendingIntent requestCode for each different notification type, instead of blindly using 0 as the requestCode.
  3. Switch from using PendingIntent.FLAG_UPDATE_CURRENT to PendingIntent.FLAG_CANCEL_CURRENT.
  4. Changed the small icon from a vector drawable to standard PNG resource at the various different resolutions.

None of that seems to have made any difference. I'm at a total loss as to how to proceed. The only idea I have left is to disable notifications if Android version is 7.0 and the device model is one of those showing up in my crash reports.

jkasten2 commented 6 years ago

@GrahamBorland Thanks for the details!

Like OneSignal, are you displaying notifications in reaction to the android.intent.action.MY_PACKAGE_REPLACED Intent? Are you able to reproduce the issue? Even inconsistently on your own device?

GrahamBorland commented 6 years ago

@jkasten2

are you displaying notifications in reaction to the android.intent.action.MY_PACKAGE_REPLACED Intent?

No, my notifications display shortly after startup after running some database queries.

Are you able to reproduce the issue? Even inconsistently on your own device?

Never reproduced locally, on an emulator or a 7.0 Samsung device.

GrahamBorland commented 6 years ago

Incidentally, I'm creating my notifications with android.support.v4.app.NotificationCompat, support lib version 27.0.2.

GrahamBorland commented 6 years ago

FWIW the workaround we've gone with for now looks like this.

private val deviceBlacklist = listOf(
    "LGUS997",
    "LG-H872",
    "LGMP450",
    ...
sinhpn92 commented 6 years ago

Have any solution to fix this issue? I have same problem with Samsung device on Android 7.0

jkasten2 commented 6 years ago

@sinhpn92 There is a work around you can use noted in https://github.com/OneSignal/OneSignal-Android-SDK/issues/263#issuecomment-369096027

547453396 commented 6 years ago

I also have this issue. But I do not used OneSignal.

krzysiek-zgondek commented 6 years ago

Maybe it's somehow related to this: https://developer.android.com/guide/topics/data/autobackup.html

vaibhav-droid commented 6 years ago

I am not using One Signal SDK but getting the same error

Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package packagename: Couldn't expand RemoteViews for: StatusBarNotification(pkg=packagename user=UserHandle{0} id=100 tag=null score=0: Notification(pri=0 contentView=packagename/0x1090064 vibrate=null sound=android.resource://packagename/raw/notification defaults=0x0 flags=0x10 kind=[null])) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5095) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) at dalvik.system.NativeStart.main(NativeStart.java)

We got it in YU (os 4.4.4)

mahesh-gupta-23 commented 6 years ago

I was facing the same error on same device with same Android version but the issue which I found was different. I don't know if this would help in this case but give a try. So I was using a custom layout with Android's Notification and RemoteViews classes and was getting the exact same error. After wasting an hour on it I found that the problem was with the Android's RemoteViews which was not supporting ConstraintLayout. So as soon as I changed the ConstraintLayout to RelativeLayout the code worked. RemoteViews only support following layout classes: FrameLayout LinearLayout RelativeLayout GridLayout and other widget classes as mentioned here. Hope this helps.

vaibhav-droid commented 6 years ago

@mahesh-gupta-23 I am not using any custom view for the notification but still getting the error so it might be some another case.

alexlee0528 commented 6 years ago

I have this issue and getting the crash reports every day from android os 7.0. Any solution for this?

ramkailash-mob-incedo commented 6 years ago

Fatal Exception: android.app.RemoteServiceExceptionBad notification posted from package x.y.z: Couldn't expand RemoteViews for: StatusBarNotification(pkg=x.y.z user=UserHandle{0} id=412 tag=null score=0 key=0|x.y.z|412|null|10097: Notification(pri=0 contentView=x.y.z/0x109007e vibrate=null sound=null defaults=0x0 flags=0x8 color=0xff000000 category=transport actions=3 vis=PUBLIC)) Raw Text

 

ramkailash-mob-incedo commented 6 years ago

If anyone found the solution. Then plz update me.

Asad4429 commented 6 years ago
android.app.RemoteServiceException: 

  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1651)

  at android.os.Handler.dispatchMessage (Handler.java:102)

  at android.os.Looper.loop (Looper.java:154)

  at android.app.ActivityThread.main (ActivityThread.java:6121)

  at java.lang.reflect.Method.invoke (Method.java)

  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:889)

  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:779)

OneISignal version 3.8.3 Android sdk: 27.1.1 BuildToolVersions: 27.0.3

jack2jm commented 6 years ago

Same here. most of noughet version crashes this.

LG,Motorola,Xiaomi Devices. any solution for that. ? @jkasten2

jkasten2 commented 6 years ago

@Jack2jm You can disable the restore on app upgrade feature by following the instruction in my post above. https://github.com/OneSignal/OneSignal-Android-SDK/issues/263#issuecomment-369096027

jkasten2 commented 6 years ago

We disable the notification restore feature on the app update event for Android 7.0 devices in release 3.9.1. We haven't seen any recent reports of older versions of Android or never any newer Android devices.

Please make sure you have this version or newer before reporting. A link to crashlytics and a full stack trace with the exception will be helpful if you are seeing issues still after this update

bhallionOhbibi commented 6 years ago

Hello there,

We are facing this issue with the Unity version of the plugin. Could you release the fix on this version aswell ?

Thanks !

jkasten2 commented 6 years ago

@bhallionOhbibi It was also updated. This is included in the ~OneSignal Unity SDK 2.7.1~ OneSignal Unity SDK 2.7.2.

ianmedeiros commented 6 years ago

I will post here what I think is the flow to reproduce this crash. The problem happens BEFORE the package is replaced, so, listening to MY_PACKAGE_REPLACED probably will not solve the problem if you have an ONGOING notification while upgrading, for example.

As stated before, it only happens when an update is triggered. What happens is that during the upgrade, the resource files are replaced and while the notification is still visible, a system event trigger the rendering of the notification with the resource-ids of the older version, before the notification pointers are updated to the new version.

old version/old resources -> update starts -> resources are replaced -> the notification is still visibile and pointing to the old resources ids -> the resources changed all it's id's and the update didn't finished yet -> the notification is rendered but fails to expand because can't find the resources it was pointing to -> BAD_NOTIFICATION_POSTED -> MY_PACKAGE_REPLACED event is triggered.

For example, your app do an: mNotificationBuilder.setSmallIcon(R.drawable.ic_notification)

In your old version R.drawable.ic_notification = 0xf279bc3 In your new version, after build your resource can became R.drawable.ic_notification = 0xf32aa83

This becomes clear and problematic if you have a visible ONGOING notification while the upgrade is triggered, as I have in my app. As soon as you introduce this on your app, this crashes will start to flood your crashlogs while deploying new versions.

One possible solution would be to use the public.xml file to make all resources used by your notification constant, but this build-step is becoming deprecated with newer gradle versions, plus you will always get this crash from versions that are upgraded from versions before you introduced the public.xml file in your build.

In reality it's seems a lot with an Android bug handling notifications while upgrading.

jkasten2 commented 6 years ago

@ianmcoelho Thanks for the insight. I believe you are correct that the resource ids are changing are the source of the issue when the app is updated. OneSignal does not use ongoing notifications but I can see how this could be a possible way to trigger this crash. Have you been able to reproduce the BAD_NOTIFICATION_POSTED crash with an ongoing notification in your testing?

ianmedeiros commented 6 years ago

That's the major problem of this bug. It's just not possible to reproduce. I tried every possible way imaginable, with no success.

I am "guessing" what's happening by the following evidence:

There is this stackoverflow post that is related with this subject, and I tried every single thing described there, replacing vector-drawables, trying to catch the MY_PACKAGE_REPLACED event, setting all id's of the ongoing notification in the public.xml file, with no success.

TopeMateo commented 6 years ago

@jkasten2 hello, what functionalities of OneSignal are going to be disabled if I apply the workaround you posted here?

jkasten2 commented 6 years ago

@TopeMateo When the app is updated on the device notifications will disappear, however they will still show back up when the user opens the app.

Updating to OneSignal 3.9.1 will have the same effect however it is only limited to Android 7.0 as this is where we are seeing crash reports from.

TopeMateo commented 6 years ago

@jkasten2 thank you!

jpusp commented 6 years ago

@jkasten2 I have updated my app with OneSignal 3.9.1 and i had no more crashes on devices after 5 days of release. Thanks!!!

Behrouz-m commented 5 years ago

Look at the id value:

Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package br.com.vivadecora.app: Couldn't expand RemoteViews for: StatusBarNotification(pkg=br.com.vivadecora.app user=UserHandle{0} >>>>id=1610499692<<<< tag=null key=0|br.com.vivadecora.app|1610499692|null|10093: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x218 color=0xffcd3128 groupKey=filter vis=PUBLIC))

it is showing u the resource id that has the problem. find it in R class. I had a similar issue with RemoteViews. I removed AppCompat Views then it fixed.

chatup003 commented 5 years ago

I am getting this exception on Android 5.0 on many devices

Fatal Exception: android.app.RemoteServiceException Bad notification posted from package {package_name}: Couldn't expand RemoteViews for: StatusBarNotification(pkg={package_name} user=UserHandle{0} id=1 tag=null score=10 key=0|{package_name}|1|null|10130: Notification(pri=1 contentView={package_name}/0x109008d vibrate=null sound=null defaults=0x0 flags=0x10 color=0xffdf3931 actions=1 originalPackageName=N originalUserId=0 vis=PRIVATE))

Behrouz-m commented 5 years ago

check this: contentView={package_name}/0x109008d find this 0x109008d in your R class

janbolat commented 5 years ago

@jkasten2 Any updates on the issue? Seems only Nougat users are facing the problem. Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package ****: Couldn't expand RemoteViews for: StatusBarNotification(pkg=**** user=UserHandle{0} id=-982247708 tag=null key=0|****|-982247708|null|10163: Notification(pri=-1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x18 color=0x00000000 vis=PUBLIC semFlags=0x0 semPriority=0)) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1813) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)

image