错误内容
There was a timeout error capturing the layout data from the device.
The device may be too slow, the captured view may be too complex, or the view may contain animations.
Please retry with a simplified view and ensure the device is responsive.
错误原因
如错误提示所示,这种获取布局的失败常常发生在布局较复杂的场景,比如SytemUI的statusWindow的布局截取。
原因是AndroidStudio获取布局时传入的超时时间默认是20s,超过这个时间还没有获取结果就会显示这个错误。
具体代码如下:
@JvmStatic
fun captureView(
window: ClientWindow, options: LayoutInspectorCaptureOptions
): LayoutInspectorResu