Tried to obtain display from a Context not associated with one. Only visual Contexts (such as Activity or one created with Context#createWindowContext) or ones created with Context#createDisplayContext are associated with displays. Other types of Contexts are typically related to background entities and may return an arbitrary display.
java.lang.UnsupportedOperationException: Tried to obtain display from a Context not associated with one. Only visual Contexts (such as Activity or one created with Context#createWindowContext) or ones created with Context#createDisplayContext are associated with displays. Other types of Contexts are typically related to background entities and may return an arbitrary display.
at android.app.ContextImpl.getDisplay(ContextImpl.java:3041)
at android.content.ContextWrapper.getDisplay(ContextWrapper.java:1161)
at com.android.tools.agent.appinspection.proto.ViewExtensionsKt.getDefaultDisplayRotation(ViewExtensions.kt:181)
at com.android.tools.agent.appinspection.proto.ViewExtensionsKt.createAppContext(ViewExtensions.kt:157)
at com.android.tools.agent.appinspection.CaptureExecutor.sendLayoutEvent(CaptureExecutor.kt:173)
at com.android.tools.agent.appinspection.CaptureExecutor.executeCapture(CaptureExecutor.kt:145)
at com.android.tools.agent.appinspection.CaptureExecutor.access$executeCapture(CaptureExecutor.kt:42)
at com.android.tools.agent.appinspection.CaptureExecutor$execute$1.run(CaptureExecutor.kt:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
描述 Bug
使用ToastUtils时导致App闪退
相关代码
异常堆栈
截图