Mac installation and configuration adb command environment (detailed steps)

1. Note: The prerequisite is to install the java environment.

Because some packages developed in the android sdk depend on the java language, first of all, make sure that the java environment has been configured.

2. Configure the android adb command environment under Mac, the configuration method is as follows:

1. Download and install IDE (android studio)

Android Studio official website download link

注意区分:本机Mac是Inter芯片还是apple的M系列芯片,别选错了版本。

insert image description here
For detailed installation links, please refer to Installing Android studio on Mac

2. Configuration environment

After the installation is complete, add the directory where the android adb tool is located to the environment variable.

(1) Modify the contents of the .bash_profile file

Type in the terminal vim ~/.bash_profileto open the .bash_profile file.    
Press i to enter input mode,
and add the following at the end of the file content:

export ANDROID_HOME=/Users/xxx/Library
export PATH=${
    
    PATH}:/Users/xxx/Library/Android/sdk/platform-tools
export PATH=${
    
    PATH}:/Users/xxx/Library/Android/sdk/tools
  • Note: xxx represents the user name, modify it according to your actual user name

点击 esc, enter :wqEnter (to save and exit the text).

(2) Make changes effective

Enter: in the terminal source ~/.bash_profileto make the changes take effect.

3. Test

Type in terminal: adb version
output:

Android Debug Bridge version 1.0.41
Version 31.0.0-7110759
Installed as /Users/xxx/Library/Android/sdk/platform-tools/adb

Type in terminal: adb devices
output:

List of devices attached

This shows that the android adb command can be used normally.

[References]:
https://juejin.cn/post/7097138535718715406
https://blog.csdn.net/csdndouniwan/article/details/94164263

Guess you like

Origin blog.csdn.net/xiaoyue_/article/details/132020304