Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1137010
  • 博文数量: 103
  • 博客积分: 1897
  • 博客等级: 上尉
  • 技术积分: 1717
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-19 21:02
文章分类

全部博文(103)

文章存档

2013年(19)

2012年(84)

分类: Java

2012-05-01 20:57:54

  学android 也有一段是间了,最近买了一台中兴u960s的android手机,进行真机测试。但是发现怎么样都没办法x选中真机的设备,在android 的sdk选择器上,确实能够看到我的中兴手机的图标,但是,却是一大堆的问号在设备选择器的列表上。我郁闷 了好久,去网上找了很多的资料,最总在android的官方文档上找到了解决的方案。
   在android官方文档的dev guide 的tab标签下有
Using Hardware Devices    
这个专题,是专门讲如何在真机下面调试android程序的,里面关于linux环境下真机试验的配置要求是这样的。
    • If you're developing on Ubuntu Linux, you need to add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. For a list of vendor IDs, see USB Vendor IDs, below. To set up device detection on Ubuntu Linux:
      1. Log in as root and create this file: /etc/udev/rules.d/51-android.rules.

        Use this format to add each vendor to the file:
        SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" 

        In this example, the vendor ID is for HTC. The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node.

        Note: The rule syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules.

      2. Now execute:
        chmod a+r /etc/udev/rules.d/51-android.rules

When plugged in over USB, can verify that your device is connected by executing adb devices from your SDK platform-tools/ directory. If connected, you'll see the device name listed as a "device."


大致意思是说,要在linux下真机调试android程序。

首先,要在新建一个文件:/etc/udev/rules.d/51-android.rules.,即是51-android.rules

文件的示例内容为

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" 

其中,venderId 是代表不同设备商,mode 指的是该设备的读写权限,group 代表这个设备属于那个组

保存文件后,执行

chmod a+r /etc/udev/rules.d/51-android.rules

(注意,以上的操作都是要在root下进行)

然后从新跑一下你的android程序,就可以发现eclipse可以识别你的机子并把它安装到真机上了。。

下面是不同厂商对应的venderId,我的机子是中兴的(ZTE),对应是“19d2”

USB Vendor IDs

This table provides a reference to the vendor IDs needed in order to add USB device support on Linux. The USB Vendor ID is the value given to the ATTR{idVendor}property in the rules file, as described above.

CompanyUSB Vendor ID
Acer0502
ASUS0b05
Dell413c
Foxconn0489
Fujitsu04c5
Fujitsu Toshiba04c5
Garmin-Asus091e
Google18d1
Hisense109b
HTC0bb4
Huawei12d1
K-Touch24e3
KT Tech2116
Kyocera0482
Lenovo17ef
LG1004
Motorola22b8
NEC0409
Nook2080
Nvidia0955
OTGV2257
Pantech10a9
Pegatron1d4d
Philips0471
PMC-Sierra04da
Qualcomm05c6
SK Telesys1f53
Samsung04e8
Sharp04dd
Sony054c
Sony Ericsson0fce
Teleepoch2340
Toshiba0930
ZTE19d2

阅读(3428) | 评论(3) | 转发(1) |
0

上一篇:笔试智力题

下一篇:排序算法之快速排序

给主人留下些什么吧!~~

thomaslwq2012-05-03 22:19:24

无色T恤: 实践中的问题值得关注,多谢楼主的分享了.....
过奖了,这只是一些小问题而已。。

无色T恤2012-05-03 21:54:11

实践中的问题值得关注,多谢楼主的分享了

夏冰软件2012-05-02 16:34:57

您写的文章很不错,支持一下