美文网首页
Android 9 系统 Uiautomatorviewer 使

Android 9 系统 Uiautomatorviewer 使

作者: 暮色尘封 | 来源:发表于2020-04-04 20:14 被阅读0次

    今天我准备使用 Uiautomatorviewer 对小米8手机进行调试时出现报错,无法获取UI信息(系统版本 android 9)。

    Uiautomatorviewer 抓取报错信息.PNG

    问题出现的原因是:android 8以后sdk自带的uiautomator直接打开,截取不到机器界面信息。

    建议可以使用以下方法手动截取(adb命令)。

    1.截取uix文件,并转移到电脑E盘根目录

    adb shell uiautomator dump /sdcard/app.uix

    adb pull /sdcard/app.uix E:/app.uix

    2.截取截图,并转移到电脑E盘根目录

    adb shell screencap -p /sdcard/app.png

    adb pull /sdcard/app.png E:/app.png

    3.打开sdk tools目录下的uiautomatorviewer.bat,导入从机器获取的截图和资源文件


    因为每次都得写四行代码,比较麻烦所以写了一个小bat文件,
    放到桌面直接运行即可

    新建一个文本文档,名字自己起如uni.bat(注意把后缀给改成.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
    

    相关文章

      网友评论

          本文标题:Android 9 系统 Uiautomatorviewer 使

          本文链接:https://www.haomeiwen.com/subject/rulsphtx.html