本文翻译自:Set up adb on Mac OS X
I spent quite sometime figuring how to set up adb on Mac, so I figure writing how to set it up might be useful to some people. 我花了相当一段时间搞清楚如何建立亚洲开发银行在Mac上,所以我的数字写如何设置它可能是对某些人有用。 adb is the command line tool to install and run android apps on your phone/emulator adb是用于在手机/模拟器上安装和运行android应用的命令行工具
#1楼
参考:https://stackoom.com/question/1D72y/在Mac-OS-X上设置ADB
#2楼
echo "export PATH=\\$PATH:/Users/${USER}/Library/Android/sdk/platform-tools/" >> ~/.bash_profile && source ~/.bash_profile
如果您将android-sdks文件夹放在其他目录中,请使用android-sdks / platform-tools目录替换该路径
#3楼
Personally I just source my .bashrc in my .bash_profile: 我个人只是在.bash_profile中提供.bashrc:
echo 'source ~/.bashrc' >> ~/.bash_profile
So I put it in my .bashrc. 所以我把它放在我的.bashrc中。 And I'm using Android Studio, so it was a different path. 而且我正在使用Android Studio,所以这是一条不同的道路。
echo 'PATH=$PATH:$HOME/Library/Android/sdk/platform-tools/' >> ~/.bashrc
You may also want the following: 您可能还需要以下内容:
echo 'ANDROID_HOME=$HOME/Library/Android/sdk' >> ~/.bashrc
#4楼
cd sdk/platform-tools/
,然后使用./adb devices
代替
#5楼
if you are using Android Studio in MAC OS X , you could exec the following command in your terminal app: 如果您在MAC OS X中使用Android Studio,则可以在终端应用程序中执行以下命令:
echo 'alias adb="/Applications/Android\ Studio.app/sdk/platform-tools/adb"' >> .bashrc
exec $SHELL
and next: 接下来:
adb devices
and you should be showing a list with your android devices connected via USB cable in your MAC, for example something like this: 并且您应该显示一个列表,其中列出了通过MAC中的USB电缆连接的android设备,例如:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
deb7bed5 device
#6楼
NOTE: Path for adb has changed since Android Studio 1.0.xx 注意:自Android Studio 1.0.xx起,adb的路径已更改
For bash shell, use: 对于bash shell,请使用:
echo 'export PATH=$PATH:'$HOME'/Library/Android/sdk/platform-tools' >> ~/.bash_profile
For tcsh shell, use: 对于tcsh shell,请使用:
echo 'setenv PATH $PATH\:'$HOME'/Library/Android/sdk/platform-tools' >> ~/.tcshrc