vbox ubuntu adtbundle 手机调试

来源:互联网 发布:红极一时的网络歌曲 编辑:程序博客网 时间:2024/06/03 22:57

ubuntu 下正确安装android手机驱动

1. 查看手机ID号。

复制代码
charlesxue@THSHIBA:~/setup/cocos2d-x/cocos2d-x-2.1.4/projects/simpleGame/proj.android/bin$ lsusbBus 001 Device 002: ID 10f1:1a19 Importek Bus 001 Device 003: ID 0bda:0159 Realtek Semiconductor Corp. Digital Media Card ReaderBus 002 Device 005: ID 05c6:9031 Qualcomm, Inc. Bus 002 Device 003: ID 0bda:8197 Realtek Semiconductor Corp. RTL8187B Wireless AdapterBus 006 Device 002: ID 062a:4101 Creative Labs Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
复制代码

想知道哪个是手机的usb口,很简单的办法就是插上手机执行一下lusb命令,然后拔掉手机再次执行一下lusb比较一下打印结果。在这里我的手机usb驱动是

Bus 002 Device 005: ID 05c6:9031 Qualcomm, Inc.

在这一步今天碰到一个比较怪的问题是手机的usb显示如下:

Bus 002 Device 005: ID 2171:9031

只显示这些内容。然后执行adb devices 也检测不到任何设备。这时用拨号方法打开usb调试即可解决--在拨号键盘输入*#*#717717#*#*.

2.写驱动配置文件。

创建文件  /etc/udev/rules.d/51-android.rules 并写入

  1 SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"  (此处少一个参数,见下部分的帖子,红色标出)

更改权限

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

3.重启usb设备

sudo /etc/init.d/udev restart

 

4.重启adb服务。

adb kill-serveradb start-server

5.查看设备是否检测到

adb devices
List of devices attached 20444975    unauthorized
-------------------------------------------------------------------------------------------------------------------


以前在模拟器上跑程序,这一次小组好不容易整了个G3,为了证明自己的Android没有白浪费时间自学,写了个“hello,walfred”,编译生成apk,可是通过usb连接上电脑却出现问题。

使用adb devices 出现如下:

List of devices attached

???????????? no permissions

同时在DDMS中显示设备名也显示????????????,也无法显示进程名,无法查看log。

解决方法:

1、设置usb权限

因为ubuntu这样的系统都是默认以非root身份在运行的,要使用usb调试,需要sudo支持。

$ lsusb

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 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 003: ID 413c:2106 Dell Computer Corp.

Bus 002 Device 002: ID 0461:4d81 Primax Electronics, Ltd

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

列表中,Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp. 这一行为htc手机的usb使用端口,记录一下,id为0bb4(基于上所有的htc都是这个ID)据网上的资料说,由于后来的使用Android系统的手机越来越多,每款手机都分配了idVendor,但解决方法都一样。

$sudo vim /etc/udev/rules.d/70-android.rules

加入以下内容:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c87",MODE="0666"

其中的idvendor idProduct指的是USB的ID可以使用lsusb查询得到。

比如我的是:在你没有连接其他外设之前只要找到最后不是root hub的这一行留意下就行。

Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp

ID 0bb4 就是idVendor ,0c87就是 idProduct

运行命令,重启udev:

$sudo chmod a+rx /etc/udev/rules.d/70-android.rules

$sudo service udev restart

2、不需要重启计算机,重新启动adb server下就ok

(很重要)拔掉usb重新连上再执行:

sudo ./adb kill-server

./adb devices

./adb root (这一步很重要 )

goodkuck

------------------------------------------------------------------------------------------------------------

Failed to install  apk on device java.io.IOException: EOF


问题:Failed to install *.apk on device *: timeout

可能项目越做越大吧(其实是图片多^-^),到了后面每次调试安装时都出现Failed to install *.apk on device *: timeout
现在将这个问题整理出来,以便以后查阅。

错误出现:连接真机调试的时候如果连接太久没响应就会出现timeout

根据网上众多资料:可分为这几个解决方法

方法由简单到麻烦:

1.在window-》prensent....-》android-》设置ddms的timeout时间。这种是就最有效、最简洁的。

2.delete android里面的 apk,保证速度。不过试过一次后,真机好像变“聪明了”,也出现timeout。

3.Cleaning the project (Project->Clean),不行就重启eclipse或者android,很郁闷的是,重启后运行第一次可以。第二次就开始变慢了,也就是出现timeout

4.网上一个我没试过的方法:

Don't use spaces in your directory names. If you have files that are in such a directory (e.g., stuff inside of C:\Program Files\), copy them to another spot that does not have spaces.

很明显是说目录里面不要有空格,排除


0 0
原创粉丝点击