简体   繁体   English

如何捕获BadTokenException在我的应用程序中发生的位置?

[英]How to catch where BadTokenException happens in my application?

note: this is not a repeated question 注意:这不是重复的问题

Hi, I have this exception in my application 嗨,我的申请中有这个例外

Fatal Exception: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@dff5aa2 is not valid; is your activity running?
   at android.view.ViewRootImpl.setView(ViewRootImpl.java:920)
   at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:377)
   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:105)
   at android.widget.Toast$TN.handleShow(Toast.java:747)
   at android.widget.Toast$TN$2.handleMessage(Toast.java:622)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:154)
   at android.app.ActivityThread.main(ActivityThread.java:6823)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1557)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

I found a lot of questions ask about this crash and I know that it mostly happens because of showing in a finished 我发现了很多有关此崩溃的问题,并且我知道它主要是由于在完成的中显示而发生的

the problem is I am working on a big application with a great number of custom s in a lot of activity, I tried to review all of it by eyes but it was very hard and as you see the logs from Crashlytics is not saying where it happens 问题是我正在使用大量自定义进行大量活动的大型应用程序,我试图用查看所有内容,但是这非常困难,而且正如您看到的Crashlytics日志中所说的那样,它发生了

What I am asking for: Is there is any tool or way help me to review my code and catch an error like that? 我要的是:有没有什么工具或方法可以帮助我检查代码并捕获类似的错误?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM