question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Fail at com.getcapacitor.Splash$2.run: android.view.WindowManager$BadTokenException

See original GitHub issue

Bug Report

Thank you all for your great work! I hope you can help me.

I’m getting this fail my Google Play Console, mostly on SDKs 29, 28 but also on 23 and 24:

android.view.WindowManager$BadTokenException: 
  at android.view.ViewRootImpl.setView (ViewRootImpl.java:806)
  at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:356)
  at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:94)
  at com.getcapacitor.Splash$2.run (Splash.java:276)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:193)
  at android.app.ActivityThread.main (ActivityThread.java:6746)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 2.4.6
  @capacitor/core: 2.4.6
  @capacitor/android: 2.4.6
  @capacitor/electron: 2.4.6
  @capacitor/ios: 2.4.6

Installed Dependencies:

  @capacitor/core 2.2.1
  @capacitor/cli 2.2.1
  @capacitor/ios 2.2.1
  @capacitor/android 2.2.1
  @capacitor/electron not installed

Platform(s)

  • Android

Other Technical Details

npm --version output: 6.14.4

node --version output: v12.17.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tobikacommented, Mar 9, 2021

I also have this issue logged on sentry. Although it seems to be very very rare.

Versions:

    "@capacitor/android": "^2.4.2",
    "@capacitor/core": "^2.4.2",

Will update to latest version and see if there are more logs.

android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@47bc254 for displayid = 0 is not valid; is your activity running?
    at android.view.ViewRootImpl.setView(ViewRootImpl.java:936)
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:398)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:131)
    at com.getcapacitor.Splash$2.run(Splash.java:290)
    at android.os.Handler.handleCallback(Handler.java:907)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:216)
    at android.app.ActivityThread.main(ActivityThread.java:7625)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
0reactions
ionitron-bot[bot]commented, Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"android.view.WindowManager$BadTokenException ...
This helped me out massively. I was trying to create a dialog from within another dialog and just having "AlertDialog.Builder(this);" was giving an...
Read more >
Troubleshooting Android Issues
This error may occur when using the run command if the JAVA_HOME environment variable is not set. To resolve, set JAVA_HOME as an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found