小米手机 连接在Ubuntu 下调试

最近的一个项目需要用到linux开发Android程序! 发现Ubuntu有小米开发连接不上! 搞了一个下午才搞成功! 看看吧!

小米手机利用USB连接到Ubuntu 10.04系统。运行下面的命令:

@linuxidc:~$ lsusb

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 002: ID 17ef:1003 Lenovo

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 003: ID 046d:c06c Logitech, Inc.

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 003: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 005: ID 18d1:9025

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

拔掉手机的USB连接线,再运行:

@linuxidc:~$ lsusb

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 002: ID 17ef:1003 Lenovo

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 003: ID 046d:c06c Logitech, Inc.

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 003: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

对比发现,Bus 001 Device 005: ID 18d1:9025 就是小米手机的

sudo gedit /etc/udev/rules.d/53-android.rules在打开的文件中增加以下文本:

SUBSYSTEM==”usb”, SYSFS{idVendor}==”04e8″, MODE=”0666″

SUBSYSTEM==”usb”, ATTR{idVendor}==”04e8″, ATTR{idProduct}==”685e”, SYMLINK+=”android_adb”

sudo chmod a+rx /etc/udev/rules.d/53-android.rules

@linuxidc:/etc/udev/rules.d$ sudo service udev restart //or restart udev

udev start/running, process 7147

在 android sdk 的 tools 目录下运行 (这一步很重要,必须要sudo,否则没效果)

@linuxidc:~/star2011/SDK/android-sdk-linux/platform-tools$ sudo ./adb kill-server

@linuxidc:~/star2011/SDK/android-sdk-linux/platform-tools$ sudo ./adb devices

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

List of devices attached

然后,就可以直接用adb shell操作了.也可以用Eclipse来调试。

,今天又是美好的一天,我要展示出我优秀的一面。不必一味讨好别人

小米手机 连接在Ubuntu 下调试

相关文章:

你感兴趣的文章:

标签云: