我们可以先编辑uiautomatorviewer.bat脚本,在文本底部添加 pause,不让脚本一启动就闪退,查看报错的原因,如果是以下这个原因:
-Djava.ext.dirs=lib\x86_64;lib is not supported. Use -classpath instead. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
将
rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat中的
set java_exe=
call lib\find_java.bat
替换成下列代码:
set java_exe=C:\Program Files (x86)\Java\jdk1.8.0_161\bin\java.exe(你安装Java的路径)