firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.63k stars 1.83k forks source link

CountryListSpinner.java line 109 com.firebase.ui.auth.ui.phone.CountryListSpinner.onFocus #2013

Open postfixNotation opened 3 years ago

postfixNotation commented 3 years ago

Firebase Crashlytics just reported a new app crash with the following stacktrace:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.the.best.app.on.planet.earth/com.firebase.ui.auth.ui.phone.PhoneActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
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:765)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
       at android.widget.PopupWindow.invokePopup(PopupWindow.java:1433)
       at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:1284)
       at androidx.appcompat.widget.AppCompatPopupWindow.showAsDropDown(AppCompatPopupWindow.java:77)
       at androidx.core.widget.PopupWindowCompat.showAsDropDown(PopupWindowCompat.java:69)
       at androidx.appcompat.widget.ListPopupWindow.show(ListPopupWindow.java:754)
       at com.firebase.ui.auth.ui.phone.CountryListSpinner.onFocus(CountryListSpinner.java:109)
       at com.firebase.ui.auth.ui.phone.CountryListSpinner.onFocusChanged(CountryListSpinner.java:101)
       at android.view.View.handleFocusGainInternal(View.java:6631)
       at android.view.View.requestFocusNoSearch(View.java:10868)
       at android.view.View.requestFocus(View.java:10847)
       at android.view.View.requestFocus(View.java:10814)
       at android.view.View.requestFocus(View.java:10756)
       at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2139)
       at android.app.Activity.onRestoreInstanceState(Activity.java:1102)
       at android.app.Activity.performRestoreInstanceState(Activity.java:1057)
       at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1260)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

I'm using FirebaseUI for Android v8.0.0 and what's most interesting is the device that caused the app crash: LGE Nexus 5X Android 8.1.0

I suspect that this device is an automated system that regularly triggers crashes in my app. I also saw this notorious phone multiple times mentioned in other issues. Also this device tends to trigger crashes at very similar times of the day...

This is all data I have considering this bug. I hope this helps. Also it's questionable if this needs a fix at all.

Zayankovsky commented 2 years ago

This crash happens when you expand country code selection and then rotate your phone.

6vedant commented 1 year ago

Its sad to see its still not yet resolved.