vim ~/.bash_profile
添加以下:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
export ANDROID_SDK_ROOT=/Users/admin/Library/Android/sdk
export ANDROID_NDK_ROOT=/Users/admin/Library/Android/ndk/android-ndk-r10e
export PATH=${PATH}:${JAVA_HOME}:${ANDROID_SDK_ROOT}:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/tools:${JAVA_HOME}:${JAVA_HOME}/bin:${ANDROID_NDK_ROOT}
执行source ~/.bash_profile
若有问题则重新执行
export PATH="/usr/local/bin:/usr/local/sbin:~/bin"