关于android真机测试(linux系统下)

今天测试程序,在虚拟机上运行出问题,于是用真机来测试,但是发现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

于是可以用真机测试了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值