android 8.0 以后 uiautomator 无法直接使用的问题

android8.1以后sdk tools自带的uiautomator直接打开,截取不到设备界面信息。

可以使用以下方法手动截取。

首先操作设备定位到要分析的界面。

1.截取uix资源文件

adb shell uiautomator dump /sdcard/screen.uix

adb pull /sdcard/screen.uix D:/screen.uix

2.截取截图

adb shell screencap -p /sdcard/screen.png

adb pull /sdcard/screen.png D:/screen.png

运行sdk/tools目录下的uiautomatorviewer.bat,导入从设备获取的截图和资源文件

原文地址:https://www.cnblogs.com/copyworker/p/11043705.html