UiAutomator 关于 uiautomatorviewer 无法定位元素问题,提示报错 Error while obtaining UI hierarchy XML file: com.android.ddmlib.TimeoutException

vic · 2017年05月05日 · 最后由 玮琪 回复于 2019年09月18日 · 3494 次阅读


如图;
各种百度,各种尝试,还是出现此问题,网上此类问题不多,国外论坛看得云里雾里,排除了手机问题,尝试了多款手机,都报这一个错误,以前一直用的好好的,突然这样了,确实很无力,希望有踩过坑的大神给点思路。

共收到 18 条回复 时间 点赞
vic #1 · 2017年05月05日 Author

Error while obtaining UI hierarchy XML file: com.android.ddmlib.TimeoutException
贴上报错提示
@DoctorQ 还麻烦大神指点一下。

你先把 appium-client 关掉再来问,appium 如果在运行中,你这样不报错才怪。

vic #3 · 2017年05月05日 Author
大海 回复

必须关啊大兄弟,重启电脑第一件事就是连手机开 uiautomatorviewer 也是这样。

vic 回复

你多试几次,我之前经常出现这样的问题,然后关了 appium,每次打开,都成功

vic #16 · 2017年05月05日 Author
大海 回复

其他报错都能解决,就这个 com.android.ddmlib.TimeoutException,很棘手

vic 回复

超时异常,没遇到过

你找下 uiautomatorviewer 的源码看下,定位看下是什么原因会报这个错,再解决导致这个问题的原因,这才是正确的解决问题的思路。

—— 来自 TesterHome 官方 安卓客户端

vic #8 · 2017年05月05日 Author
Crazyerick 回复

源码倒是找到了,请问如何定位原因呢?

vic #9 · 2017年05月08日 Author

😂 😂 😂 help me

vic #11 · 2017年05月08日 Author

能成功 dump xml 文件到 local/tmp 路径下,但是就是不在 uiautomatorviewer 工具中展示

https://testerhome.com/topics/1988

其中有这么一个解决方案,你看看行不行

call adb shell uiautomator dumpcall 
call adb pull /storage/sdcard/window_dump.xml .
call window_dump.xml

hierarchyviewer 试试吧

vic #9 · 2017年05月09日 Author

xml 能成功 dmup 下来,就是没有截图,只有层级元素,找起来不方便,hierarchyviewer 工具还不太会使用,打开后一直没有数据。

20楼 已删除
vic 回复

我刚刚也遇到你这个问题了,不仅是超时,还有什么找不到对象,以及 devices offline 等

vic 回复

问题解决了,重启设备,重启 appium,重启 uiautomatorivew

vic #4 · 2017年05月12日 Author
大海 回复

我每次都是超时异常,重启无果

大海 回复

我也是这么干的

我是连接安卓 9.0,打开报 Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!
Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!
错误,请问有人有遇到过么

wuxq 回复

换个低版本的安卓,马上好了(我啥方法都试过了)

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册