adb no permissions问题

来源:互联网 发布:为什么c语言的头文件 编辑:程序博客网 时间:2024/05/18 02:35


 Google一番,得知可以通过用root权限启动adb server来解决问题,但是每次用adb不会很麻烦嘛?!

后来发现在SDK的帮助文档里有关于这个问题的说明:

If you’re developing on Ubuntu Linux, you need to add a rules file that contains a USB configuration for each type of device you want to use for development. Each device manufacturer uses a different vendor ID. The example rules files below show how to add an entry for a single vendor ID (the HTC vendor ID). In order to support more devices, you will need additional lines of the same format that provide a different value for the SYSFS{idVendor} property. For other IDs, see the table of USB Vendor IDs, below.

  1. Log in as root and create this file: /etc/udev/rules.d/51-android.rules.

    For Gusty/Hardy, edit the file to read:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

    For Dapper, edit the file to read:
    SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"

  2. Now execute:
    chmod a+r /etc/udev/rules.d/51-android.rules

 

只要按照说明,在/etc/udev/rules.d/目录下创建51-android.rules文件,写入自己手机的信息就好了。
什么?你有多个不同品牌的Android手机或平板?每一个都添加自然是可以的,当然也有简便方法啦。
只要在51-android.rules中保留一行

1 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0666"

就好了~
修改以后重新插入你的Android设备,运行adb devices命令看看:

 

List of devices attached
M1105bfb6840 device

怎么样可以识别了吧~