将这些环境变量添加到我的~/.bash_profile
ANDROID_HOME=/Users/username/Library/Android/sdk
PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
JAVA_HOME=$(/usr/libexec/java_home)
PATH=${JAVA_HOME}/bin:$PATH
在运行Appium Doctor时不会阻止这些警告:
ANDROID_HOME is NOT set!
JAVA_HOME is NOT set!
adb could not be found because ANDROID_HOME is NOT set!
android could not be found because ANDROID_HOME is NOT set!
emulator could not be found because ANDROID_HOME is NOT set!
Bin directory for $JAVA_HOME is not set
相反,我必须在每个打开新终端
的实例中手动添加环境变量export
export ANDROID_HOME=/Users/username/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH
知道为什么Appium无法识别~/.bash_profile
中定义的环境变量?
感谢。
答案 0 :(得分:1)
我必须从变量~/.bash_profile
中导出变量才能保留,而不是从命令行导出
export ANDROID_HOME=/Users/username/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH