在mac平台开发Android,如果需要用到adb命令,一般会这么提示:提示adb命令不存在。
lzj:~ lizhijun$ adb devices
bash: adb: command not found
现在我们在Mac上将Android SDK的adb命令添加到环境变量中
我们先需要找到自己下载安装的SDK目录,本机SDK路径是:/App/adt-bundle-mac-x86_64-20140702/sdk
第一步、启动终端
进入Home目录下
cd $HOME
第二步、编辑.bash_profile文件
当该文件存在时,打开并编辑该文件
open -e .bash_profile
如果该文件不存在,可通过如下命令创建:
touch .bash_profile
打开.bash_profile文件,对其内容进行编辑,在末尾添加SDK目录下的platform-tools 和 tools命令如下:
export PATH=${PATH}:/App/adt-bundle-mac-x86_64-20140702/sdk/platform-tools
export PATH=${PATH}:/App/adt-bundle-mac-x86_64-20140702/sdk/tools
可根据SDK的安装目录进行修改
保存文件,关闭.bash_profile
更新刚配置的环境变量,命令如下:
source .bash_profile
到这里,我们就成功配置好了adb命令了。我们可以用adb命令验证配置是否成功,命令如下:
adb devices