Android 常见的Crash的产生和处理

Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?

发生这个Crash的原因时,应该检查当你为Window添加一个Window的时机是否正确。更改添加时机,比如public void onWindowFocusChanged(boolean hasFocus)方法中

android.view.WindowManager$InvalidDisplayException: Unable to add window android.view.ViewRootImpl$W@ea68937 -- the specified window type 0 is not valid

发生这个Crash的原因应该是没有指定Window的类型,Window一般有三种类型,分别为 Application windows,Sub-windows,System windows

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容