mac通过adb命令安装apk包
实现步骤如下:
- 安装adb
(1)安装Homebrew
**安装命令:**/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
选择下载源 1
安装成功后,注意查看brew安装目录:/opt/homebrew/bin
配置环境变量:
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
**brew的用法:**
// 查询:
brew search 软件名
// 安装:
brew install 软件名
// 卸载:
brew uninstall 软件名
// 更新 Homebrew:
brew update
// 查看 Homebrew 配置信息:
brew config
**什么是homebrew?**
Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷。Homebrew主要有四个部分组成: brew、homebrew-core 、homebrew-bottles、homebrew-cask。
(2)安装android-platform-tools
brew install --cask android-platform-tools
安装成功:
android-platform-tools was successfully installed!
(3)检查是否安装成功
yanzis-MacBook-Pro% adb devices
daemon not running; starting now at tcp:5037
daemon started successfully
List of devices attached
-
android 手机链接mac电脑,【手机-设置-开发者选项-启用,USB调试-启用】
yanzis-MacBook-Pro% adb devices
daemon not running; starting now at tcp:5037
daemon started successfully
List of devices attached
1e359489 unauthorized 【这里需要手机授权,授权成功后,如下】yanzis-MacBook-Pro% adb devices
List of devices attached
1e359489 device -
通过adb install命令安装apk文件,【执行命令后,需要在手机上进行相应操作来完成安装】【mac直接复制,路径就有了】
yanzis-MacBook-Pro% adb install /Users/yanzis/Downloads/XXX_V1.0_20200201-commonTest.apk
Performing Streamed Install
Success
yanzis-MacBook-Pro%