在Ubuntu下ADT识别不出真机的解决办法
前两天把系统换成Ubuntu 12.04,今天在写代码的时候准备真机调试,结果ADT识别不出真机,我擦。果断网上查找了一下解决办法,经过半个小时左右的折腾,尼玛,终于搞定了。具体解决办法如下:
1.先插上手机在命令行下输入lsusb指令
sxd@sxd-ThinkPad-T400:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 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 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0425:0001 Motorola Semiconductors HK, Ltd
Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
Bus 004 Device 003: ID 0a5c:2145 Broadcom Corp. Bluetooth with Enhanced Data Rate II
Bus 002 Device 006: ID 18d1:9025 Google Inc.
sxd@sxd-ThinkPad-T400:~$
2.拔掉手机,再次输入lsusb
sxd@sxd-ThinkPad-T400:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 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 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0425:0001 Motorola Semiconductors HK, Ltd
Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
Bus 004 Device 003: ID 0a5c:2145 Broadcom Corp. Bluetooth with Enhanced Data Rate II
sxd@sxd-ThinkPad-T400:~$
通过对比,可以确定Bus 002 Device 006: ID 18d1:9025 Google Inc.就是对应真机关联的ID。
3. 输入以下命令
sxd@sxd-ThinkPad-T400:~$ cd /etc/udev/rules.d/
sxd@sxd-ThinkPad-T400:/etc/udev/rules.d$ sudo gedit 88-android.rules
创建一个名为88-android.rules的文件,文件名可以任意取。然后编辑,写入一下内容,之后保存关闭。
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE=="0666"
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="18d1", MODE=="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="9025", MODE=="0600,"SYMLINK+="android_adb"
4.保存后给予权限:
sudo chmod a+rx/etc/udev/rules.d/88-android.rules
5. sudo /etc/init.d/udev restart 或者 sudo restartudev
6. 切换到ADT sdk plam-tools文件夹下,重启adb相关操作。
cd /home/sxd/Android_ADT/adt-bundle-linux-x86_64-20131030/sdk/platform-tools
sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb device
说明:测试的真机是 小米1S (MI OneS)
参考:
http://blog.csdn.net/yunnywu/article/details/8550834
http://blog.chinaunix.net/uid-24856020-id-3388654.html