Skip to content

firebase in-appmessaging throws exception onPause() #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bolds07 opened this issue Apr 26, 2019 · 7 comments · Fixed by #941
Closed

firebase in-appmessaging throws exception onPause() #379

bolds07 opened this issue Apr 26, 2019 · 7 comments · Fixed by #941

Comments

@bolds07
Copy link

bolds07 commented Apr 26, 2019

[READ] Step 1: Are you in the right place?

yes

[REQUIRED] Step 2: Describe your environment

Android Studio version: 3.2
Firebase Component: in-appmessagins
Component version: 17.1.1
Compile/Target SDK version: 28

[REQUIRED] Step 3: Describe the problem

exception is thrown on real devices in production:

Fatal Exception: java.lang.RuntimeException: Unable to pause activity {com.tomatedigital.instagramgiveawaywinner/com.tomatedigital.giveawaymaster.activity.LoginActivity}: java.lang.IllegalArgumentException: View=com.google.firebase.inappmessaging.display.internal.layout.FiamRelativeLayout{77ccd1a V.E...... .......D 0,0-540,549 #7f0900be app:id/modal_root} not attached to window manager
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4668)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4627)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4602)
       at android.app.ActivityThread.access$1300(ActivityThread.java:229)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1832)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:7406)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Caused by java.lang.IllegalArgumentException: View=com.google.firebase.inappmessaging.display.internal.layout.FiamRelativeLayout{77ccd1a V.E...... .......D 0,0-540,549 #7f0900be app:id/modal_root} not attached to window manager
       at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:451)
       at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:377)
       at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:140)
       at com.google.firebase.inappmessaging.display.internal.FiamWindowManager.destroy(FiamWindowManager.java:90)
       at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay.removeDisplayedFiam(FirebaseInAppMessagingDisplay.java:495)
       at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay.onActivityPaused(FirebaseInAppMessagingDisplay.java:221)
       at android.app.Application.dispatchActivityPaused(Application.java:247)
       at android.app.Activity.onPause(Activity.java:1665)
       at android.support.v4.app.FragmentActivity.onPause(FragmentActivity.java:470)
       at com.tomatedigital.adinjector.AdsAppCompatActivity.onPause(AdsAppCompatActivity.java:168)
       at android.app.Activity.performPause(Activity.java:7061)
       at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1340)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4654)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4627)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4602)
       at android.app.ActivityThread.access$1300(ActivityThread.java:229)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1832)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:7406)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Steps to reproduce:

I can't say exactly how to reproduce since it is happening on production, but as firebase in-appmessaging is quite transparent to developer you should be able to investigate

Relevant Code:

none of my code is involved in the exception only inner api calls

@google-oss-bot
Copy link
Contributor

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

@Gaket
Copy link

Gaket commented Jun 21, 2019

Have the same issue and the same issue of the library.

@kbot
Copy link

kbot commented Aug 22, 2019

I believe I'm experiencing the same issue. It is currently the number one crash in our app. We've been updating to the latest version of the libraries each release in hopes that it would be fixed with no luck.

Caused by java.lang.IllegalArgumentException: View=com.google.firebase.inappmessaging.display.internal.layout.FiamFrameLayout{52b867 V.E...... .......D 0,0-1080,221 #7f090057 app:id/banner_root} not attached to window manager
       at android.view.WindowManagerGlobal.findViewLocked + 533(WindowManagerGlobal.java:533)
       at android.view.WindowManagerGlobal.removeView + 433(WindowManagerGlobal.java:433)
       at android.view.WindowManagerImpl.removeViewImmediate + 124(WindowManagerImpl.java:124)
       at com.google.firebase.inappmessaging.display.internal.FiamWindowManager.destroy + 90(com.google.firebase:firebase-inappmessaging-display@@17.1.1:90)
       at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay.removeDisplayedFiam + 495(com.google.firebase:firebase-inappmessaging-display@@17.1.1:495)
       at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay.onActivityPaused + 221(com.google.firebase:firebase-inappmessaging-display@@17.1.1:221)
       at android.app.Application.dispatchActivityPaused + 273(Application.java:273)
       at android.app.Activity.onPause + 1791(Activity.java:1791)
       at android.support.v4.app.FragmentActivity.onPause + 470(FragmentActivity.java:470)
       at com.nextplus.android.activity.BaseActivity.onPause + 904(BaseActivity.java:904)
       at com.nextplus.android.activity.BaseConnectingActivity.onPause + 141(BaseConnectingActivity.java:141)
       at com.nextplus.android.activity.HomeActivity.onPause + 1304(HomeActivity.java:1304)
       at android.app.Activity.performPause + 7606(Activity.java:7606)
       at android.app.Instrumentation.callActivityOnPause + 1465(Instrumentation.java:1465)
       at android.app.ActivityThread.performPauseActivityIfNeeded + 4250(ActivityThread.java:4250)
       at android.app.ActivityThread.performPauseActivity + 4215(ActivityThread.java:4215)
       at android.app.ActivityThread.handlePauseActivity + 4167(ActivityThread.java:4167)
       at android.app.servertransaction.PauseActivityItem.execute + 45(PauseActivityItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState + 145(TransactionExecutor.java:145)
       at android.app.servertransaction.TransactionExecutor.execute + 70(TransactionExecutor.java:70)
       at android.app.ActivityThread$H.handleMessage + 1947(ActivityThread.java:1947)
       at android.os.Handler.dispatchMessage + 106(Handler.java:106)
       at android.os.Looper.loop + 214(Looper.java:214)
       at android.app.ActivityThread.main + 7037(ActivityThread.java:7037)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 494(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main + 965(ZygoteInit.java:965)

@adaemmrich
Copy link

adaemmrich commented Sep 3, 2019

Any updates on this issue? This is the most frequent crash in my app.

An additonal check (if the view is attached to the window manager) might be required for bindingWrapper.getRootView() in the destroy() call of the FiamWindowManager?

@JasonAHeron
Copy link
Contributor

Hey friends, let me look into this again. This has been impossible for me to reproduce in test but these additional logs look really helpful so lets see if I can get it solved once and for all.

@jeffharris23
Copy link

@JasonAHeron have you been able to make any progress with this?

@JasonAHeron
Copy link
Contributor

Okay so I have an idea for a fix. Unfortunately I still can't reproduce this but based on the provided logs it seems like the FIAM is being removed when it's not actually displayed. So hopefully improving the "isDisplayed" logic will fix this. https://github.com/firebase/firebase-android-sdk/pull/941/files

@firebase firebase locked and limited conversation to collaborators Nov 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants