安装
- 直接安装
sudo apt-get install android-tools-adb
- 如果发现源中没有这个程序
sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install android-tools-adb
连接手机
- 查询USB设备id
lsusb
- 输出结果
Bus 001 Device 002: ID 8087:8001 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 006: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 002 Device 005: ID 8087:07dc Intel Corp.
Bus 002 Device 004: ID 1bcf:2b90 Sunplus Innovation Technology Inc.
Bus 002 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 002 Device 007: ID 2717:ff48
Bus 002 Device 002: ID 413c:301a Dell Computer Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
配置
- 配置adn连接文件
1d6b
从上一步查询得到
echo 0x1d6b >> ~/.android/adb_usb.ini
- 配置udev
sudo vim /etc/udev/rules.d/70-android.rules // 写入下面内容
UBSYSTEM=="usb", ATTRS{idVendor}=="1d6b", ATTRS{idProduct}=="0003",MODE="0666"
修改权限并重启udev
sudo chmod 755 /etc/udev/rules.d/70-android.rules sudo service udev restart
查看adb设备
adb kill-server adb start-server adb devices