【学习笔记】【MAC】sdk自带uiautomatorviewer启动报错问题解决

运行命令

 cd sdk/tools

./uiautomatorviewer 

错误信息

-Djava.ext.dirs=/Users/env/android-sdk-macosx/tools/lib is not supported.  Use -classpath instead.

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

解决方案

jdk版本不匹配,回退版本至8,详细如下

1.下载jdk1.8版本,并安装

下载地址:https://www.oracle.com/java/technologies/javase-jdk8-downloads.html

2.进入sdk/tools目录,vi runuiautomatorviewer.sh

#runuiautomatorviewer.sh

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
export JAVA_BIN=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin
export PATH=$JAVA_BIN:$JAVA_HOME:$PATH
./uiautomatorviewer

3.运行bash runuiautomatorviewer.sh即可正常启动uiautomatorviewer工具

你可能感兴趣的:(学习笔记)