FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

Unable to add window -- token null is not valid; is your activity running?

Open ArcherEmiya05 opened this issue 3 years ago • 2 comments

Welcome to FirebaseUI and thanks for submitting an issue!

Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.

If not, please feel free to fill in the following info so we can help faster!

Step 1: Are you in the right place?

Yes

Step 2: Describe your environment

  • Android device: Nexus 5X
  • Android OS version: 6.0.1
  • Google Play Services version: 4.3.13
  • Firebase/Play Services SDK version: 21.0.6
  • FirebaseUI version: 8.0.1

Step 3: Describe the problem:

Running the app that uses Firebase UI (Phone Auth) with Firebase Test Lab, there is an intermittent issue with country list. I never encounter this issue personally thus I am not sure how to exactly reproduce it and I don't see any issue on the Test matrix video.

Steps to reproduce:

N/A

Observed Results:

CountryListSpinner.java line 109
com.firebase.ui.auth.ui.phone.CountryListSpinner.onFocus 
 
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sample.app/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:2416)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5421)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

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:567)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:310)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
       at android.widget.PopupWindow.invokePopup(PopupWindow.java:1258)
       at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:1110)
       at androidx.appcompat.widget.AppCompatPopupWindow.showAsDropDown(AppCompatPopupWindow.java:77)
       at androidx.core.widget.PopupWindowCompat$Api19Impl.showAsDropDown(PopupWindowCompat.java:247)
       at androidx.core.widget.PopupWindowCompat.showAsDropDown(PopupWindowCompat.java:71)
       at androidx.appcompat.widget.ListPopupWindow.show(ListPopupWindow.java:757)
       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:5478)
       at android.view.View.requestFocusNoSearch(View.java:8476)
       at android.view.View.requestFocus(View.java:8455)
       at android.view.View.requestFocus(View.java:8422)
       at android.view.View.requestFocus(View.java:8401)
       at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2043)
       at android.app.Activity.onRestoreInstanceState(Activity.java:1008)
       at android.app.Activity.performRestoreInstanceState(Activity.java:963)
       at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1163)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2389)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5421)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Expected Results:

No error

ArcherEmiya05 avatar Aug 07 '22 07:08 ArcherEmiya05

Just encounter this today again, is there any fix for this?

image

ArcherEmiya05 avatar Sep 15 '24 10:09 ArcherEmiya05

#2013

ArcherEmiya05 avatar Oct 07 '24 05:10 ArcherEmiya05

Hello,

Thank you for taking the time to submit this bug.

A new release is planned shortly, which should resolve this request.

In the meantime, we will close this issue, if this is not resolved in the new version - please feel free to create a new issue for this bug.

demolaf avatar Nov 17 '25 17:11 demolaf