Ubuntu-ADT-连接Anroid真机-无法识别问题

转自:http://skzr-org.iteye.com/blog/1141224


在linux里面,模拟器可以直接识别,使用adb也没有限制,但是手机插上usb之后,adb并不识别,显示的是问号,在eclipse里面也是这样。

      解决方法如下:

      1.在bash中输入lsusb,可以看到很多BUS设备,很多都是Linux Foundation 1.1 root hub的,这是没有插上usb设备的端口,插上手机的端口会出现另外的字符串,比如我的是High Tech Computer Corp. 然后记下它的id:0bb4:0c02

 

      2.在/etc/udev/rules.d目录下新建一个51-android.rules文件,内容如下:

<span style="font-size:18px;">    SUBSYSTEM=="usb|usb_device", SYSFS{idVendor}=="0bb4", MODE="0660",GROUP="plugdev"  
    SUBSYSTEM=="usb|usb_device", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", SYMLINK+="android_adb"  
    SUBSYSTEM=="usb|usb_device", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c01", SYMLINK+="android_fastboot"   </span>

这里的idVendor是第一步中记下的id。


3.执行如下命令

<span style="font-size:18px;">chmod a+r /etc/udev/rules.d/51-android.rules  
sudo adb kill-server  
sudo adb devices  </span>




法二:

所以我就能知道

Bus002 Device 002: ID 04e8:685e Samsung Electronics Co., Ltd

这行是手机了,所以我应该如下操作:

1)sudo gedit  /etc/udev/rules.d/53-android.rules
在打开的文件中增加以下文本:
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="685e", SYMLINK+="android_adb"
 
2) 运行以下命令:
sudo chmod a+rx /etc/udev/rules.d/53-android.rules
sudo /etc/init.d/udev restart
3) 在 android sdk 的 tools 目录下运行 (这一步很重要,必须要sudo,否则没效果)
sudo ./adb kill-server
sudo ./adb devices
然后,就可以直接用 adb  shell来进行操作了。

之后就可以识别了,在这里列出了两个手机,其它的应该也差不多。


要是重启之后又连不上了,使用如下方法:

1.Setting ownership of the adb binary (owner – root, owner group - user_group):

chown root:user_group adb

2.Setting permissions with SUID:

chmod 4550 adb

This should result something similar to this (ls -llh):

-r-sr-x---. 1 root user_name 1.2M Jan 8 11:42 adb

After that you will be able to run adb as a root, event though you'll be using your normal user account. You can run Eclipse as a normal user and your HTC should be discovered properly.

./adb devices 
List of devices attached 
HT0BPPY15230    device 

转自: http://stackoverflow.com/questions/14460656/android-debug-bridge-adb-device-no-permissions

猜你喜欢

转载自blog.csdn.net/u012421735/article/details/41611385