1.手机通过USB接入PC,进入安卓SDK安装根目录,将手机当前屏幕dump
安卓SDK安装目录>platform-tools\adb.exe shell uiautomator dump
输出如下:
UI hierchary dumped to: /storage/emulated/legacy/window_dump.xml
2.从手机获取dump出来的xml文件到当前目录,注意扩展名更改为.uix
安卓SDK安装目录>platform-tools\adb.exe pull /storage/emulated/legacy/window_dump.xml 你想要的文件名.uix
输出类似如下:
/storage/emulated/legacy/window_dump.xml: 1 file pulled. 0.7 MB/s (16413 bytes in 0.021s)
3.手机当前屏幕界面截图,并查看定位正确的文件名
安卓SDK安装目录>platform-tools\adb shell ls -a /storage/sdcard0/Pictures/Screenshots
输出类似如下:
Screenshot_2017-01-21-20-52-30.png
Screenshot_2017-01-21-22-23-06.png
Screenshot_2017-03-29-22-47-37.png
Screenshot_2019-04-23-03-16-53.png
Screenshot_2019-04-23-03-30-10.png
4.获取屏幕截图到PC当前目录
安卓SDK安装目录>platform-tools\adb pull /storage/sdcard0/Pictures/Screenshots/Screenshot_2019-04-23-03-30-10.png
输出类似如下:
/storage/sdcard0/Pictures/Screenshots/Screenshot_2019-04-2...0-10.png: 1 file pulled. 3.4 MB/s (395037 bytes in 0.109s)
5. 运行uiautomatorviewer.bat,打开,分别选取上述2个文件
安卓SDK安装目录>tools\bin\uiautomatorviewer.bat