我安装了带有 Android SDK 平台 API 30 的 Android Studio v4.1。还安装了 Java 版本:v14.0.2
我的路径设置如下:
PATH=/usr/bin:/bin:/usr/sbin:/sbin
export PATH
PATH=/usr/local/bin:/usr/local/sbin:"$PATH"
PATH=/opt/local/bin:/opt/local/sbin:"$PATH"
#JAVA PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home
export PATH=$JAVA_HOME/bin
#ANDROID PATH
export ANDROID_HOME=/Users/pratt/Library/Android/sdk
export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH
#NODE PATH
export NODE_HOME=/usr/local/Cellar/node/14.14.0/bin/node
export PATH=$PATH:$NODE_HOME
export PATH=$PATH:/usr/local/lib/node_modules/npm/bin
#HomeBrew sbin path
export PATH=/usr/local/sbin:$PATH
这是 echo $PATH 的输出:
/usr/local/sbin:/Users/pratt/Library/Android/sdk/emulator:/Users/pratt/Library/Android/sdk/tools:/Users/pratt/Library/Android/sdk/tools/bin:/Users/pratt/Library/Android/sdk/platform-tools:/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home/bin:/usr/local/Cellar/node/14.14.0/bin/node:/usr/local/lib/node_modules/npm/bin
但是当我去Android/sdk/tools/bin
,并打开一个名为uiautomatorviewer
我得到这个错误的文件:
~ pratt$ uiautomatorviewer
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 31: dirname: command not found
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 32: basename: command not found
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 38: basename: command not found
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 59: uname: command not found
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 60: [: ==: unary operator expected
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 66: uname: command not found
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 66: [: =: unary operator expected
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 70: expr: command not found
/Users/pratt/Library/Android/sdk/tools/bin/uiautomatorviewer: line 86: //bin/archquery: No such file or directory
Error: Invalid or corrupt jarfile //
这是为什么?我想我已经正确设置了所有路径。尝试删除并重新安装 Android Studio 但同样的问题再次发生。任何解决方案将不胜感激。