Android设备的识别

来源:互联网 发布:淘宝上的上海大药房 编辑:程序博客网 时间:2024/04/30 04:03

本文解决实体android设备在ubuntu系统下无法识别的问题

系统:ubuntu12.04LTS

1.在如下位置建立如下文件:/etc/udev/rules.d/51-android.rules

2.确保android设备和电脑连接,在Terminal输入

$ lsusb

会出现设备信息如:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 046d:c52f Logitech, Inc. Wireless Mouse M305
Bus 001 Device 005: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 002 Device 008: ID 18d1:0002 Google Inc.
Bus 002 Device 004: ID 17ef:4810 Lenovo Integrated Webcam [R5U877]

找到你的设备,我这里是

Bus 002 Device 008: ID 18d1:0002 Google Inc. 

将”ID“的值18d1加入第3步

3.在第一步创建的文件”51-android.rules“文件中添加如下信息:

执行以下命令打开文件

$ sudo gedit /etc/udev/rules.d/51-android.rules

并添加:

SUBSYSTEM == "usb",SYSFS{"Google Inc."} == "18d1",MODE = "0666"

保存并退出。

4.运行以下命令

$ sudo chmod a+rw /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 11166

这样的错误。用

$ service udev restart

代替

$ sudo /etc/init.d/udev restart

5.在android sdk的platform-tools目录下运行(很重要)

$ sudo ./adb kill-server

$ sudo ./adb start-server


<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>