Mac 运行uiautomatorviewer报错解决,因为jd

2023-03-29  本文已影响0人  苏村的南哥

[转载]

Last login: Thu Mar 30 10:35:19 on ttys000
/Users/knight/MyResources/FileInstall/Installfile/android-sdk-macosx/tools/uiautomatorviewer ; exit;
~ /Users/knight/MyResources/FileInstall/Installfile/android-sdk-macosx/tools/uiautomatorviewer ; exit;
-Djava.ext.dirs=/Users/knight/MyResources/FileInstall/Installfile/android-sdk-macosx/tools/lib/x86_64:/Users/knight/MyResources/FileInstall/Installfile/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.

Saving session...completed.

[进程已完成]

解决方案

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工具

上一篇 下一篇

猜你喜欢

热点阅读