最近的一个项目需要用到linux开发Android程序!发现Ubuntu有小米开发连接不上!搞了一个下午才搞成功!看看吧!
小米手机利用USB连接到Ubuntu 10.04系统。运行接下来的Linux命令:
www@linux:~$ 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连接线,再运行:
www@linux:~$ 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
www@linux:/etc/udev/rules.d$ sudo service udev restart //or restart udev
udev start/running, process 7147
在 android sdk 的 tools 目录下运行 (这一步很重要,必须要sudo,否则没效果)
www@linux:~/star2011/SDK/android-sdk-linux/platform-tools$ sudo ./adb kill-server
www@linux:~/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来调试。
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。