Solve the problem of ADB: command not found on MAC

Programmer algorithm practice must read, common Java API skills to share>>>

When using MAC for development, sometimes you need to use the ADB instruction to perform some operations. However, if you have not configured the Android environment variables, you may encounter the problem of ADB: command not found. After checking some information, here is a record of how to configure the Android environment variables on Mac

Open the terminal terminal of the Mac and enter Cd ~/[enter the home directory of the current user]

Enter touch. Bash_ Profile [if not. Bash_ Profile, create a file]

Enter open. Bash_ Open the file we created, and a text edit box will pop up. If the environment is configured for the first time, the text edit box will be blank

Write the following code in the open text editor:

export ANDROID_HOME=/usr/local/opt/android-sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

Note the Android in 4_ Home should be filled in according to its own SDK path, and the rest can be copied directly. As for the SDK path, you can open Android studio and search the SDK in preference (Windows setting) to view it

Enter source. Bash in the terminal_ Profile [make our changes effective]

Enter ADB [verify whether the configuration is completed. If the ADB: command not found is not displayed, the configuration is completed]

Similar Posts: