安装命令:
sudo pt-get install android-tools-adb
adb --version // 查看版本
adb devices //查看连接设备
Android设备连接后无法使用:
linux@51:~$ adb shell
error: insufficient permissions for device: user in plugdev group; are your udev rules wrong?
See [http://developer.android.com/tools/device.html] for more information
1、lsusb 查看连接的 usb 设备:
(可以根据插入设备之前 lsusb命令 输出,确认当前设备)
linux@51:~$ lsusb
Bus 001 Device 003: ID 17ef:201c XXXXX //Android 设备名称
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
2、添加权限
linux@51:~$ vim /etc/udev/rules.d/51-android.rules //文件中添加下列语句
SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="201c", MODE="0666"
其中:ATTRS{idVendor}字段对应的是android设备的VID,ATTRS{idProduct}字段对应的是android设备的PID
更改文件权限:
linux@51:~$ sudo chmod a+x /etc/udev/rules.d/51-android.rules
3、重启 USB 和 adb 服务:
service udev restart
adb kill-server
adb start-server
adb devices
linux@51:~$ service udev restart
linux@51:~$ adb kill-server
linux@51:~$ adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
linux@51:~$ adb devices
List of devices attached
004401116520640 device
注意:若还是 “ no permissions “ ,建议重启系统