Question

I have the following stacktrace reported in the Amazon App Store. I have three major problems with analyzing it:

  1. I could never reproduce it, since it only seems to happen with Kindle Fire tablets and I don't have one
  2. The stacktrace I have available does not contain my app package, so it's hard to figure out which line in my code causes that actually
  3. It happens only occasionally, about 95% of Amazon Kindle fire sessions seem to be without any problem

The stacktrace provided by Amazon Developer Reporting (that is all I got from them...)

android.view.WindowManager$BadTokenException
    at android.view.ViewRootImpl.setView(ViewRootImpl.java:525)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:301)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
    at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
    at android.app.Dialog.show(Dialog.java:295)
    at android.webkit.WebView$ActionPopupWindow.onClick(WebView.java:5867)
    at android.view.View.performClick(View.java:3540)
    at android.view.View$PerformClick.run(View.java:14167)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4558)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)

Additional infos about the devices it happens: (according to Google Analytics App tracking)

  1. Devices: Kindle Fire HD 7, Kindle Fire HD 8.9
  2. OS: "Amazon" android 4.0.3 & 4.0.4

My interpretation of the stacktrace so far is that something goes wrong with a Dialog in my app, but it is so weird that on other devices than Kindle Fire it all works (incl. Froyo & Gingerbread devices!). And the line with the WebView confuses me, because I don't have a webview included anywhere..

There are some other questions about BadTokenException already, but what I have researched, the solutions don't seem to fit for my case. Like for example this question but I don't do multithreaded things within the app, so shouldn't work for me either. Maybe I missed something there?

Do you have any idea what can be the causing this? Since it only happens rarely and only Kindles it is not a big problem for me, but I would like to understand what is going on.

Edit: Another suspect is the Admob advertisment, that could explain the occasional occurence (maybe sometimes some sort of kindle-unfriendly ads show up?)

Was it helpful?

Solution

You are right,this is exception regarding dialog itself. I found few links.Hope it works for you.

http://www.jjoe64.com/2011/06/how-to-fix-windowmanager.html
http://stackoverflow.com/questions/1561803/android-progressdialog-show-crashes-with-getapplicationcontext
http://stackoverflow.com/questions/22034495/window-manager-bad-token-exception-android

The reason is that the sum times dialog box is unable to notice that its parent activity is finished or not.Most important observation is that it is rare and uncertain issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top