把usb 手机开启到usb调试模式,然后用usb线连接手机
安装adb
如果下载速度很慢,请使用vpn
终端需要先安装brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
使用brew安装adb
brew install android-platform-tools
然后执行查看链接的设备
adb devices
会看见usb链接的设备
881QAESMUFMWV device
使用命令可以看见设备连接详细信息
system_profiler SPUSBDataType
结果如下:
可以看到881QAESMUFMWV 在下面详细信息里面 Serial Number后面是一样的,代表设备连接成功.
2023-08-08 13:14:29.184 system_profiler[14629:166421] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
USB:
USB 3.0 Bus:
Host Controller Driver: AppleEmbeddedUSBXHCIFL1100
PCI Device ID: 0x1100
PCI Revision ID: 0x0010
PCI Vendor ID: 0x1b73
M1881:
Product ID: 0x2d01
Vendor ID: 0x18d1 (Google Inc.)
Version: 4.04
Serial Number: 881QAESMUFMWV
Speed: Up to 480 Mb/s
Manufacturer: Meizu
Location ID: 0x02200000 / 10
Current Available (mA): 500
Current Required (mA): 500
Extra Operating Current (mA): 0
Programmable Keyboard:
Product ID: 0x0101
Vendor ID: 0xb404
Version: 1.30
Speed: Up to 12 Mb/s
Manufacturer: Megawin Technology Inc.
Location ID: 0x02100000 / 1
Current Available (mA): 500
Current Required (mA): 100
Extra Operating Current (mA): 0
USB 3.1 Bus:
Host Controller Driver: AppleT8103USBXHCI
USB 3.1 Bus:
Host Controller Driver: AppleT8103USBXHCI
BillBoard Device:
Product ID: 0x2172
Vendor ID: 0x0bda (Realtek Semiconductor Corp.)
Version: 1.00
Serial Number: 00000000000000000
Manufacturer: Realtek
Location ID: 0x00100000
tdw@tdwdeMini-m1 ~ %
打开android studio可以看到已经连接成功了.
安装apk包
终端cd进入apk包所在目录然后执行命令安装,注意如果有多个设备或者模拟器,先关闭模拟器,确保只有一个手机连接mac,否则报错有多个设备
adb install -r 名字
例如:
adb install -r app-release.apk