zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

macOS通过brew安装adb报错: Cask ‘android-platform-tools‘ is unavailable

Android安装macosadb 报错 通过 is tools
2023-09-11 14:21:25 时间

现在使用

brew tap homebrew/cask
brew install --cask android-platform-tools

安装adb是应该是会报unavailable错误的:

Cask 'android-platform-tools' is unavailable: No Cask with this name exists.

这和源没有关系,github官方源和国内源都是这个错误(我在切换源那里浪费了很多时间。)
所以正确的安装方法:

1. 通过brew安装adb

brew install Caskroom/cask/android-platform-tools

就可以了
如果出现443错误:

fatal: unable to access 'https://github.com/Caskroom/homebrew-cask/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
Error: Failure while executing; `git clone https://github.com/Caskroom/homebrew-cask /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask --origin=origin --template=` exited with 128.

通常是proxy的问题,只需要:

git config --global --unset http.proxy 
git config --global --unset https.proxy 

即可。当然,你可能需要修改hosts文件,或者此时的系统代理能让你直接访问github。
在这里插入图片描述

2. 手动安装adb

2.1 点击这里 下载android-sdk-macosx
2.2 解压并移动到某个位置

#先到下载目录
cd ~/Downloads
unzip android-sdk*.zip
mkdir ~/.android-sdk-macosx
mv platform-tools/ ~/.android-sdk-macosx/platform-tools

2.3 添加path并重载shell profile(文件名根据shell的不同而变换)

echo 'export PATH=$PATH:~/.android-sdk-macosx/platform-tools/' >> ~/.bash_profile
source ~/.bash_profile

2.4 测试adb是否正常运行

adb devices