第一步:检查是否安装homebrew
打开终端,执行命令
brew -v
若显示
-bash: brew: command not found
说明电脑未安装homebrew,进入【第二步】。
若显示
Homebrew 2.1.16
说明已安装homebrew,跳过第二步。
第二步:安装homebrew
homebrew需要用到Xcode的command Line Tools
先移步到App Store下载Xcode,下载后打开Xcode,从菜单栏选择Xcode->Preferences->Location 查看Command Line Tools是否安装,若安装显示如下图,若未安装;移步到https://developer.apple.com/download/more/
下载Xcode版本对应的Command Line Tools
image.png
image.png
回到终端执行:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装成功后出现 Installation successful 即为安装成功:
执行brew -v
检查
第三步:安装adb
brew cask install android-platform-tools
出现下图🍺android-platform-tools was successfully installed!即成功
image.png
执行
adb version
检查
至此adb已完成安装,可以用adb安装apk了,将安卓手机连接电脑,并将模式设置为开发者模式,执行install
命令安装apk
附上adb常用命令:
///查看版本号
adb version
/// 查看设备
adb devices
///安装指定apk
adb install <file>
///卸载指定包
adb uninstall <package>
///连接设备,port默认是:5555
adb connect [<host>[:<port>]]
///断开设备
disconnect [<host>[:<port>]]
///执行远程shell
adb shell
///退出远程命令
exit
///拷贝文件到设备
adb push <local><remote>
///从设备中拷贝文件:
adb pull <remote>[<local>]
///查看设备信息
adb bugreport
///查看命令帮助
adb help