新来个测试手机,连接PC后adb devices下无设备。或者是如下的no permissions:
$ adb devices
List of devices attached
???????????? no permissions
已经在手机端打开USB调试(Android4.0,设置—开发人员选项--选中USB调试),USB连接没有问题,可以打开手机的存储设备。
下面是解决的方法,主要参考网络。
1、lsusb找到设备ID
lsusb Bus 001 Device 013: ID 1ebf:7028
1ebf是idVendor,7028是idProduct
2、注册到udev的rules文件:
vim /etc/udev/rules.d/51-android.rules 添加这个ID:1ebf,如下: SUBSYSTEM=="usb", ATTR{idVendor}=="1ebf", MODE="0666" 保存文件并运行: sudo chmod a+rx /etc/udev/rules.d/51-android.rules sudo /etc/init.d/udev restart 运行结果如下: Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service udev restart Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the stop(8) and then start(8) utilities, e.g. stop udev ; start udev. The restart(8) utility is also available. udev stop/waiting udev start/running, process 14636
如果想添加的更详细,也可以这样:SUBSYSTEM=="usb", ATTRS{idVendor}=="1ebf", ATTRS{idProduct}=="7028",MODE="0666"
3、启动adb的服务
这个网上的经验是在adb工具的目录下执行,我是按照做的,成功。cd ~/program/Android/sdk/platform-tools sudo ./adb kill-server sudo ./adb start-server这样就可以了,请尝试调试的乐趣吧。
查看当前使用的adb:which adb
后记
家里的Fedora14也遇到这个问题,adb shell时报错为error: insufficient permissions for device。
也会用同样的办法解决,只是两个系统略有些区别而已。
在Fedora中用sudo来编辑51-android.rules文件竟然没有权限被拒绝了,只好直接用root来做了。命令如下所示。
[root@localhost etc]# vim udev/rules.d/51-android.rules [root@localhost etc]# chmod a+rx udev/rules.d/51-android.rules [root@localhost etc]# ./init.d/udev-post restart Usage: ./init.d/udev-post {start|stop|reload} [root@localhost etc]# udevadm control --reload-rule [root@localhost etc]# ./init.d/udev-post reload Retrigger failed udev events [ OK ]
后记2
如果上述都已经做完,那么直接运行adb devices还是有问题。
只需要重新拔掉你设备的usb,重新连接就可以了!
后记3
来此source.android.com详尽的usb列表:
# adb protocol on passion (Nexus One) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>" # fastboot protocol on passion (Nexus One) SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>" # adb protocol on crespo/crespo4g (Nexus S) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>" # fastboot protocol on crespo/crespo4g (Nexus S) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>" # adb protocol on stingray/wingray (Xoom) SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>" # fastboot protocol on stingray/wingray (Xoom) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>" # adb protocol on maguro/toro (Galaxy Nexus) SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>" # fastboot protocol on maguro/toro (Galaxy Nexus) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>" # adb protocol on panda (PandaBoard) SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>" # adb protocol on panda (PandaBoard ES) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d002", MODE="0600", OWNER="<username>" # fastboot protocol on panda (PandaBoard) SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>" # usbboot protocol on panda (PandaBoard) SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>" # usbboot protocol on panda (PandaBoard ES) SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>" # adb protocol on grouper/tilapia (Nexus 7) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>" # fastboot protocol on grouper/tilapia (Nexus 7) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>" # adb protocol on manta (Nexus 10) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>" # fastboot protocol on manta (Nexus 10) SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"
后记4:
51-android.rules是个随便起的名字,改为android.rules也是可以的!
如果仍有问题,请继续参考后记2.