Linux下真机调试Android 程序
2013-05-20 21:10
344 查看
学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:
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.
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.
List of devices attached
emulator-5554 device
???????????? no permissions
google小米真机测试无果,google Ubuntu Android 真机测试找到了线索(http://www.linuxidc.com/Linux/2011-04/34131.htm),可是又纳闷了,他列出的设备代码没有小米手机,继续google,无果,然后自己想办法,先列出解决办法:
首先手机不连电脑,运行一下命令lsusb,结果如下:
alfredtofu@alfredtofu-laptop:~/myapp/eclipse/android-sdk-linux_x86/platform-tools$ lsusb
Bus 002 Device 002: ID 8087:0024
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 093a:2510 Pixart Imaging, Inc. Hama Optical Mouse
Bus 001 Device 004: ID 058f:b002 Alcor Micro Corp.
Bus 001 Device 002: ID 8087:0024
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
手机连上电脑,再一次lsusb,结果如下:
alfredtofu@alfredtofu-laptop:/$ lsusb
Bus 002 Device 005: ID 18d1:9025
Bus 002 Device 002: ID 8087:0024
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 093a:2510 Pixart Imaging, Inc. Hama Optical Mouse
Bus 001 Device 004: ID 058f:b002 Alcor Micro Corp.
Bus 001 Device 002: ID 8087:0024
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
对比发现,多了Bus 002 Device 005: ID 18d1:9025,跟那个参考网站一对比,发现18d1正是设备ID,接下来问题就轻松解决了。
sudo vim /etc/udev/rules.d/51-android.rules
添加一下内容:
UBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
以上命令不同手机只需要改SYSFS{idVendor}=="18d1",中的18d1,至于这个代码怎么找,上面介绍了。
sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo /etc/init.d/udev restart
sudo ./adb kill-server
sudo ./adb devices
最终结果显示如下:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
emulator-5554 device
00c49bd2 device
于是可以用真机测试了。
转载地址:http://blog.csdn.net/serialization_/article/details/8507878
在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:
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.
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.
Company | USB Vendor ID |
---|---|
Acer | 0502 |
ASUS | 0b05 |
Dell | 413c |
Foxconn | 0489 |
Fujitsu | 04c5 |
Fujitsu Toshiba | 04c5 |
Garmin-Asus | 091e |
18d1 | |
Hisense | 109b |
HTC | 0bb4 |
Huawei | 12d1 |
K-Touch | 24e3 |
KT Tech | 2116 |
Kyocera | 0482 |
Lenovo | 17ef |
LG | 1004 |
Motorola | 22b8 |
NEC | 0409 |
Nook | 2080 |
Nvidia | 0955 |
OTGV | 2257 |
Pantech | 10a9 |
Pegatron | 1d4d |
Philips | 0471 |
PMC-Sierra | 04da |
Qualcomm | 05c6 |
SK Telesys | 1f53 |
Samsung | 04e8 |
Sharp | 04dd |
Sony | 054c |
Sony Ericsson | 0fce |
Teleepoch | 2340 |
Toshiba | 0930 |
ZTE | 19d2 |
今天测试程序,在虚拟机上运行出问题,于是用真机来测试,但是发现Ubuntu下不认。。调用./adb devices显示如下。。结果无法用真机测试。
List of devices attached
emulator-5554 device
???????????? no permissions
google小米真机测试无果,google Ubuntu Android 真机测试找到了线索(http://www.linuxidc.com/Linux/2011-04/34131.htm),可是又纳闷了,他列出的设备代码没有小米手机,继续google,无果,然后自己想办法,先列出解决办法:
首先手机不连电脑,运行一下命令lsusb,结果如下:
alfredtofu@alfredtofu-laptop:~/myapp/eclipse/android-sdk-linux_x86/platform-tools$ lsusb
Bus 002 Device 002: ID 8087:0024
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 093a:2510 Pixart Imaging, Inc. Hama Optical Mouse
Bus 001 Device 004: ID 058f:b002 Alcor Micro Corp.
Bus 001 Device 002: ID 8087:0024
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
手机连上电脑,再一次lsusb,结果如下:
alfredtofu@alfredtofu-laptop:/$ lsusb
Bus 002 Device 005: ID 18d1:9025
Bus 002 Device 002: ID 8087:0024
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 093a:2510 Pixart Imaging, Inc. Hama Optical Mouse
Bus 001 Device 004: ID 058f:b002 Alcor Micro Corp.
Bus 001 Device 002: ID 8087:0024
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
对比发现,多了Bus 002 Device 005: ID 18d1:9025,跟那个参考网站一对比,发现18d1正是设备ID,接下来问题就轻松解决了。
sudo vim /etc/udev/rules.d/51-android.rules
添加一下内容:
UBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
以上命令不同手机只需要改SYSFS{idVendor}=="18d1",中的18d1,至于这个代码怎么找,上面介绍了。
sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo /etc/init.d/udev restart
sudo ./adb kill-server
sudo ./adb devices
最终结果显示如下:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
emulator-5554 device
00c49bd2 device
于是可以用真机测试了。
转载地址:http://blog.csdn.net/serialization_/article/details/8507878
相关文章推荐
- Linux下真机调试Android 程序
- linux 下使用魅族mx真机调试android程序
- linux(ubuntu11.10)下手机真机调试eclipse上的android程序
- Linux下真机调试Android 程序
- 在linux下真机调试android程序
- linux(ubuntu12.04)下手机真机调试eclipse上的android程序
- android通过USB使用真机调试程序
- linux配置android真机调试的步骤
- Ubuntu下真机调试Android程序
- android stdio 如何在真机中调试程序
- Mars Chen培训之真机调试android程序
- android通过USB使用真机调试程序
- Linux下真机调试Android手机
- Eclipse中使用真机进行USB调试android程序
- 【教你android程序在真机上调试】
- 【摘录】Linux下Android手机的真机调试配置
- android通过USB使用真机调试程序
- 如何使用真机调试Android程序
- Linux下真机调试Android手机
- 真机在wifi下调试android程序