安卓8.0以后uiautomatorviewer會報錯,解決辦法如下:
參考:《android 8.0 以后 uiautomator 無法直接使用的問題》
步驟一:
先執行命令:(注意:想要定位一個頁面,每次都要執行如下命令)
adb shell uiautomator dump /sdcard/screen.uix
adb pull /sdcard/screen.uix /Users/zhangc/Desktop/XXX相關資料/測試文檔/C2BApp/Android/圖片
注明:新手機地址改成:/data/local/tmp/**.uix
本地電腦會生成一個文件:一定要每次都得生成一次
再執行命令,截圖:
cd /本地截圖路徑
adb shell screencap -p /sdcard/新文件夾/test.png
adb pull /sdcard/新文件夾/test.png
步驟二: