解决Ubuntu adb无法连接上android手机

开发环境

  • Lenovo 手机, android 4.0.1
  • Ubuntu 14.04
  • adb version: Android Debug Bridge version 1.0.31

解决步骤

断开手机与电脑连接,执行以下命令,查看自己电脑里有什么usb

lsusb

得到输出:

Bus 002 Device 004: ID 04f2:b272 Chicony Electronics Co., Ltd Lenovo EasyCamera
Bus 002 Device 003: ID 1c4f:0032 SiGma Micro 
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0bda:0139 Realtek Semiconductor Corp. RTS5139 Card Reader Controller
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

连接上手机,再次执行lsusb

Bus 002 Device 004: ID 04f2:b272 Chicony Electronics Co., Ltd Lenovo EasyCamera
Bus 002 Device 003: ID 1c4f:0032 SiGma Micro 
Bus 002 Device 013: ID 17ef:7513 Lenovo 
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0bda:0139 Realtek Semiconductor Corp. RTS5139 Card Reader Controller
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

通过比较,多了三行信息:Bus 002 Device 013: ID 17ef:7513 Lenovo
可以看到这个Lenovo手机的设备ID就是:17ef

vim打开/etc/udev/rules.d/70-android.rules
添加一行SUBSYSTEM=="usb", SYSFS{idVendor}=="17ef", MODE="0666"
其中这个17ef就是刚刚查到的设备ID,0666表示读写权限

保存退出vim

sudo chmod a+rw /etc/udev/rules.d/70-android.rules,给文件添加读写权限

sudo adb kill-server
sudo adb devices

List of devices attached 
8SHQ31202505YD6042E0    device

这样在就成功了,不知道为什么最后两个命令一定要sudo
没有sudo的话,就会输出

List of devices attached 
????????????    no permissions

你可能感兴趣的:(android)