Search code examples
androidonesignalandroid-push-notification

onesignal push gives error : leaked window DecorView@5cd239d[] that was originally added here


I set up onesignal on my native android app.

it works fine. When I push message to clients , push arrives but if the app is open it gives error.

how can I solve this?

thanks in advance

error is : 

E/WindowManager: android.view.WindowLeaked: Activity com.ehliyet.turkiye.MainActivity has leaked window DecorView@5f4e3ba[] that was originally added here
        at android.view.ViewRootImpl.<init>(ViewRootImpl.java:418)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:331)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
        at android.app.Dialog.show(Dialog.java:322)
        at com.onesignal.GenerateNotification$1.run(GenerateNotification.java:169)
        at android.app.Activity.runOnUiThread(Activity.java:5866)
        at com.onesignal.GenerateNotification.showNotificationAsAlert(GenerateNotification.java:110)
        at com.onesignal.GenerateNotification.fromJsonPayload(GenerateNotification.java:102)
        at com.onesignal.NotificationBundleProcessor.ProcessJobForDisplay(NotificationBundleProcessor.java:96)
        at com.onesignal.NotificationBundleProcessor.ProcessFromGCMIntentService(NotificationBundleProcessor.java:75)
        at com.onesignal.GcmBroadcastReceiver.startGCMService(GcmBroadcastReceiver.java:128)
        at com.onesignal.GcmBroadcastReceiver.processOrderBroadcast(GcmBroadcastReceiver.java:119)
        at com.onesignal.GcmBroadcastReceiver.onReceive(GcmBroadcastReceiver.java:70)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3040)
        at android.app.ActivityThread.-wrap18(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Application terminated.

Solution

  • the answer just add this to gradle

    implementation 'com.google.firebase:firebase-core:+'
    implementation 'com.google.firebase:firebase-messaging:+'