启动uiautomatorviewer.bat时可能出现如下错误:
Exception in thread "main" java.lang.UnsupportedClassVerifier ...
...
Unsupported major.minor version 52.0
Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
按照 stackoverflow 或者其它网站的方法,修改 uiautomatorviewer.bat、 find_java.bat,或者去系统环境变量中设置ANDROID_SWT均不可行。
最后参考 http://blog.csdn.net/scjie168/article/details/68484267,如下方法可行
将系统环境变量中的JAVA_HOME 设置为java 8
然后可以启动 UI Automator Viewer。但是又出现如下错误
Unable to connect to adb. Check if adb is installed correctly
解决方法参考 http://blog.csdn.net/hust_twj/article/details/68077188?locationNum=14&fps=1
找到 uiautomatorviewer.bat 文件最后一行, 把
call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=%prog_dir%" -jar %jarpath% %*
修改为
call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=YOUR PLATFORM TOOLS FOLDER PATH -jar %jarpath% %*