uiautomatorviewer Error obtaining UI hierarchy

今天遇到使用sdk中的uiautomatorviewer获取手机元素时,居然提示Error obtaining UI hierarchy,最后解决方案是,把下面的代码放到bat脚本中,运行一次就可以了:

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

如果还不行,用这种方式肯定可以:

  • 新建一个bat文件,内容如下:
@echo on
adb shell uiautomator dump /sdcard/app.uix
adb pull /sdcard/app.uix E:/app.uix
adb shell screencap -p /sdcard/app.png
adb pull /sdcard/app.png E:/app.png
  • 点击这个bat文件
  • 打开uiautomator.bat ,将文件加载进来


    image.png
  • 但是这样有个缺点,这个不是实时的,所以到不同也没后,每次都要点下bat文件,然后用uiautomator去打开
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 172,916评论 25 708
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,934评论 6 342
  • 1.尺寸适配1.原因 iOS7中所有导航栏都为半透明,导航栏(height=44)和状态栏(height=20)不...
    LZM轮回阅读 6,137评论 1 4
  • 有些话说出口就伤感情 ,有些误会深了就难以解释,有些事做错就无法挽回。 我这个人,不成熟,不外向,不自信...
    寂柒盏阅读 252评论 0 0