macOS 在终端中使用 adb命令,每次都要source ~/.bash_profile 才生效

Posted 第壹时间

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了macOS 在终端中使用 adb命令,每次都要source ~/.bash_profile 才生效相关的知识,希望对你有一定的参考价值。

macOS下已经配置好android开发环境,环境变量也添加了,但是在终端中使用adb命令每次都需要source .bash_profile之后才能识别,

否则就提示  zsh: command not found: adb

 

解决方案:
1、查看根目录下是否有.zshrc文件,如果没有就新建一个 touch .zshrc
2、打开这个文件 open -e .zshrc
3、在后面添加
  # Enable my profile
  source ~/.bash_profile
4、保存
5、输入source .bash_profile,是配置生效
 
然后就可以愉快的使用adb命令了。

 

以上是关于macOS 在终端中使用 adb命令,每次都要source ~/.bash_profile 才生效的主要内容,如果未能解决你的问题,请参考以下文章

在 macOS 上安装 ADB [重复]

什么adb命令会写入应用so文件

mac环境下配置adb环境以及解决-bash: adb: command not found

通过adb命令在Android设备中执行Java命令, 并调用so文件。

深入扒一扒安卓中的ADB命令

MAC系统环境变量总失效