尽管我大概在~/.bash_profile
ANDROID_SDK_ROOT=/Users/michaelcas/Library/Android/sdk
ANDROID_HOME=${ANDROID_SDK_ROOT}
JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${PATH}:${JAVA_HOME}:${JAVA_HOME}/bin:${ANDROID_HOME}
每当我尝试在OSX机器上初始化Android驱动程序时,Appium都会引发此错误
由以下原因引起:org.openqa.selenium.WebDriverException:处理命令时发生未知的服务器端错误。原始错误:目前未设置JAVA_HOME。请设置JAVA_HOME
当我运行Appium doctor时,一切正常,并且JAVA_HOME设置正确。
info AppiumDoctor ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor ✔ Node version is 11.1.0
info AppiumDoctor ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor ✔ Xcode Command Line Tools are installed.
info AppiumDoctor ✔ DevToolsSecurity is enabled.
info AppiumDoctor ✔ The Authorization DB is set up properly.
info AppiumDoctor ✔ Carthage was found at: /usr/local/bin/carthage
info AppiumDoctor ✔ HOME is set to: /Users/michaelcas
info AppiumDoctor ✔ ANDROID_HOME is set to: /Users/michaelcas/Library/Android/sdk
info AppiumDoctor ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
info AppiumDoctor ✔ adb exists at: /Users/michaelcas/Library/Android/sdk/platform-tools/adb
info AppiumDoctor ✔ android exists at: /Users/michaelcas/Library/Android/sdk/tools/android
info AppiumDoctor ✔ emulator exists at: /Users/michaelcas/Library/Android/sdk/tools/emulator
info AppiumDoctor ✔ Bin directory of $JAVA_HOME is set
修改
当我这样做
echo $JAVA_HOME
我知道
/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
Appium Doctor Java Home是
✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home