I have the following stacktrace reported in the Amazon App Store. I have three major problems with analyzing it:
- I could never reproduce it, since it only seems to happen with Kindle Fire tablets and I don't have one
- 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
- 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)
- Devices: Kindle Fire HD 7, Kindle Fire HD 8.9
- 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?)