firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.26k stars 573 forks source link

FIAM - In-App Messaging Crash #5780

Open modsfabio opened 6 months ago

modsfabio commented 6 months ago

Problem

We see a lot of crashes when a new campaign is created. The App crashes with the following stacktrace:

Caused by android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
       at android.view.ViewRootImpl.setView(ViewRootImpl.java:1596)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:509)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:133)
       at com.google.firebase.inappmessaging.display.internal.FiamWindowManager.show(FiamWindowManager.java:67)
       at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay$4$4.run(FirebaseInAppMessagingDisplay.java:416)
       at android.app.Activity.runOnUiThread(Activity.java:7258)
       at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay$4.onSuccess(FirebaseInAppMessagingDisplay.java:412)
       at com.google.firebase.inappmessaging.display.internal.FiamImageLoader$Callback.onResourceReady(FiamImageLoader.java:157)
       at com.google.firebase.inappmessaging.display.internal.FiamImageLoader$Callback.onResourceReady(FiamImageLoader.java:135)
       at com.bumptech.glide.request.SingleRequest.onResourceReady(SingleRequest.java:667)
       at com.bumptech.glide.request.SingleRequest.onResourceReady(SingleRequest.java:596)
       at com.bumptech.glide.load.engine.EngineJob.callCallbackOnResourceReady(EngineJob.java:159)
       at com.bumptech.glide.load.engine.EngineJob$CallResourceReady.run(EngineJob.java:428)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8663)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

The issue is similar to #5567, but apparently it's still not fixed. There is no code from our side.

google-oss-bot commented 6 months ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

lehcar09 commented 6 months ago

Hi @modsfabio, thank you for reaching out and reporting the issue. Somehow, I was able to reproduce the issue when the orientation changes, but the crash was inconsistent.

I checked the issue #5567, and there is a PR (#5504) that might fix the issue. However, the PR was not yet merged. I'll inform our engineers and see what we can do here. Thanks