在AndroidStuido中使用adb,报错zsh: command not found: adb,配置过程如下:
1、adb配置.bash_profile
1.1) 打开终端Terminal,输入:open .bash_profile,打开 .bash_profile文件(如果无,则自动新建)
open .bash_profile
1.2)如果已经有了,输入:open .bash_profile -e ,意思:打开并编辑该文件
open .bash_profile -e
1.3)在.bash_profile中输入: export PATH=/…下图中涂抹部分…/Library/Android/sdk/platform-tools/:$PATH

文件如下所示:

1.4)输入命令:source ~/.bash_profile,执行命令,使其立即生效
source ~/.bash_profile
2、配置 .zshrc 文件
2.1)终端中输入:open .zshrc
如果.zshrc不存在,输入touch .zshrc,创建该文件;
2.2)如果已经有了,输入:open .zshrc -e
open .zshrc -e
2.3)编辑文档如下图所示:
source ~/.bash_profile

2.4)输入:source ~/.zshrc 使其立即生效。
source ~/.zshrc
最后,AndroidStuido重启下就可以了。

这篇博客介绍了如何在Android Studio中配置adb环境。首先,通过编辑.bash_profile文件,将adb路径添加到PATH环境变量中,并使用source命令使更改生效。接着,对于使用.zshrc的用户,同样进行编辑并引入.bash_profile的内容,再次使用source命令更新配置。完成这些步骤后,重启Android Studio,adb命令就可以正常使用了。



1万+

被折叠的 条评论
为什么被折叠?



