1. Open Terminal
2. Then enter
VI. Bash_profile Press "E" to enter edit mode
3. Enter the environment variables you want to configure (Java, SDK, NDK, Gradle):
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export ANDROID_HOME=/Users/jingbin/Documents/AndroidStudio/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:/Users/jingbin/Documents/AndroidStudio/ndk/android-ndk-r10e
export A_NDK_ROOT=/Users/jingbin/Documents/AndroidStudio/ndk/android-ndk-r10e
export GRADLE_HOME=/Applications/Android\ Studio\ 2.app/Contents/gradle/gradle-2.14.1
export PATH=$PATH:$GRADLE_HOME/bin
4. Using the VI Editor
Esc
: Wq
Save and exit (Note the ":" number)
5. Update settings
source. bash_profile
6. Check that the corresponding configuration is successful
echo $PATH (view path)
Java-version
adb
Ndk-build
Gradle-version
Configuration of MAC Android development environment variables (Java, SDK, NDK, Gradle)