uiautomatorviewer.bat在android/sdk/tools/bin目录下,双击运行。
点击1号按钮,报错:
adb not installed' error when trying to take a snapshot with uiautomatorviewer
解决办法:
附上stackoverflow上的地址:
https://plus.google.com/108487870030743970488/posts/2TrMqs1ZGQv,具体内容我粘贴过来:
My first experience with the new uiautomatorviewer:
"unable to connect to the adb. check if adb is installed correctly"
Challenge Accepted:
1. ScreenshotAction class has this in its run() method when !DebugBridge.isInitialized()
2. DebugBridge is not initialized when it can't find the "platform-tools" folder which it gets via the property ""com.android.uiautomator.bindir"
3. The above property is set (in windows) in uiautomatorviewer.bat:
call %java_exe%Djava.ext.dirs=%javaextdirs% -Dcom.android.uiautomator.bindir= -jar %jarpath% %
4. Strange that it is empty isn't it. Changing the above line in my case to:
call %java_exe% -Djava.ext.dirs=%javaextdirs% -Dcom.android.uiautomator.bindir=H:\android-sdk\tools -jar %jarpath% %
This solves the issue, and UI Automator Viewer is up. The app is pretty neat with all the "mouse over"
"find view" feature.
"unable to connect to the adb. check if adb is installed correctly"
Challenge Accepted:
1. ScreenshotAction class has this in its run() method when !DebugBridge.isInitialized()
2. DebugBridge is not initialized when it can't find the "platform-tools" folder which it gets via the property ""com.android.uiautomator.bindir"
3. The above property is set (in windows) in uiautomatorviewer.bat:
call %java_exe%
我自己修改后的uiautomatorviewer.bat的内容:
call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=C:\Users\zhanglei_sx\AppData\Local\Android\Sdk\tools" -jar %jarpath% %*
以为解决了,继续点击按钮,又报错了。
Getting permission denied error while taking device screenshot from my android device by using UIAUTOMATOR。
在stackoverflow上找到解决办法,运行adb root uiautomatorviewer。好了,终于有结果了。