首先确保用数据线链接后能识别设备,输入:lsusb,可以看到类似输出
dorole@ubuntu:~$ lsusb
Bus 002 Device 006: ID 0bb4:0c87 High Tech Computer Corp.
Bus 002 Device 004: ID 0402:9665 ALi Corp.
Bus 002 Device 003: ID 04fc:05da Sunplus Technology Co., Ltd
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0951:1643 Kingston Technology
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
这样手机的vendor id和描述就出来了,第一条即是,htc的机器硬件id一般都是0bb4。
在/etc/udev/rules.d/目录下建立50-android.rules规则文件,内容如下:
SUBSYSTEM==”usb”, ATTR{idVendor}==”0bb4″, MODE=”0666″
修改后重启udev服务
dorole@ubuntu:/$ sudo /etc/init.d/udev restart
切换到android sdk的platform-tools目录下,重启adb服务,再输入adb devices就应该能找到设备了。
dorole@ubuntu:~/android-sdk-linux_x86/platform-tools$ sudo ./adb kill-server
dorole@ubuntu:~/android-sdk-linux_x86/platform-tools$ sudo ./adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
dorole@ubuntu:~/android-sdk-linux_x86/platform-tools$ sudo ./adb devices
List of devices attached
SH0CDPL00575 device
这样就可以在eclipse中的DDMS来调试android真机了,有些步骤是需要root权限的。
本文链接地址:http://dorole.com/481/