Created
July 19, 2014 08:36
-
-
Save luftreich/b982932f0d8de61fee88 to your computer and use it in GitHub Desktop.
Ubuntu adb devices :???????????? no permissions 解决方法[转
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Ubuntu adb devices :???????????? no permissions 解决方法[转] | |
| untun下USB连接Android手机后,使用adb devices 出现如下: | |
| List of devices attached | |
| ???????????? no permissions | |
| 同时在DDMS中显示设备名也显示????,也无法显示进程名,无法查看log。 | |
| 一、工具介绍 | |
| android-sdk-linux_x86/tools下有一堆工具,今天要用的是:Android Debug Bridge,在android开发过程中,这个工具是使用得最多的。(缩写adb,有点像gcc的gdb似的) | |
| adb start-server – 实际上它会启动一个 adb fork-server server | |
| adb kill-server – kill掉 | |
| adb devices – 列出所有的设备 | |
| 二、设置usb权限 | |
| 因为ubuntu这样的系统都是默认以非root身份在运行的,要使用usb调试,需要sudo支持。 | |
| $ lsusb | |
| Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | |
| Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | |
| Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | |
| Bus 002 Device 003: ID 413c:2106 Dell Computer Corp. | |
| Bus 002 Device 002: ID 0461:4d81 Primax Electronics, Ltd | |
| Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | |
| Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp. | |
| Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub | |
| 列表中,Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp. 这一行为htc手机的usb使用端口,记录一下,id为0bb4(基于上所有的htc都是这个ID)。 | |
| $sudo vim /etc/udev/rules.d/70-android.rules | |
| 加入以下内容: | |
| SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c87",MODE="0666" | |
| 其中的idvendor idProduct指的是USB的ID可以使用lsusb查询得到。 | |
| 比如我的是: | |
| lsusb | |
| Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp | |
| ID 0bb4 就是idVendor ,0c87就是 idProduct | |
| 运行命令,重启udev: | |
| $sudo chmod a+rx /etc/udev/rules.d/70-android.rules | |
| $sudo service udev restart | |
| 三、重新启动adb server | |
| (很重要)拔掉usb重新连上再执行: | |
| sudo ./adb kill-server | |
| ./adb devices | |
| ./adb root (这一步很重要 ) | |
| 四、使用usb进行调试 | |
| 问题说明中的问题至此已经得到解决。 | |
| 在DDMS选择相应的devices,可以看到log了。。。。 | |
| 五、知识积累 | |
| 1. Gooogle udev | |
| 2.拔插usb,使用以下命令可以实时监视系统信息 | |
| sudo tail -f /var/log/messages | |
| 六、参考 | |
| 1. http://edu.codepub.com/2010/1229/28405.php | |
| 2. http://blog.csdn.net/zhenwenxian/archive/2010/09/23/5901350.aspx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment