0

In Firebase I'm seeing a certain amount of crashes like:

Fatal Exception: android.view.WindowManager$BadTokenException
Unable to add window -- token android.os.BinderProxy@2518b2d is not valid; is your activity running?
android.view.ViewRootImpl.setView (ViewRootImpl.java:920)
android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:377)
android.view.WindowManagerImpl.addView (WindowManagerImpl.java:105)
android.widget.Toast$TN.handleShow (Toast.java:747)
android.widget.Toast$TN$2.handleMessage (Toast.java:622)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6823)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1557)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1445)

The usual answer is that in Android 7 that type of error occurs if you show a Toast or Dialog on an activity that has finished.

However, I have put a try...catch WindowManager.BadTokenException around all my Toast/Dialog.show() and additionally checking for !activity.isFinishing() and it's still there.

I have the suspicion that it's coming from a library. Any idea how to debug that? It's also almost impossible to reproduce. I achieved it once on the emulator, but never again.

0 Answers0