Ubuntu配置Android开发环境无法连接手机
因为一直使用Ubuntu,所以想把Android也放在Ubuntu开发了,不过用小米MiOne连接后不能识别,SN是乱码,在网上找到如下解决方法:
在/etc/udev/reles.d 文件夹下创建 51-android.rules 文件
写入 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0666"
重启adb:
$ cd your-android-sdk-linux/platform-tools $ sudo ./adb kill-server $ sudo ./adb devices
再试成功。
记得一定要断开手机连接后再连接一下。
以上是在32bit下的配置方式,在64bit需要先安装如下包:
sudo apt-get install lib32asound2 lib32z1 lib32ncurses5 lib32bz2-1.0
否则会报如下错误:
./adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
检测是否正常:
不链接手机时输入命令lsusb,查看结果:
arron:/etc/udev/rules.d$ lsusb Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub 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:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 064e:c21c Suyin Corp. Bus 001 Device 006: ID 046d:c52e Logitech, Inc. Bus 001 Device 005: ID 0489:e04e Foxconn / Hon Hai
链接手机后输入命令lsusb,查看结果:
arron:/etc/udev/rules.d$ lsusb Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 003 Device 006: ID 18d1:9025 Google Inc. 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:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 064e:c21c Suyin Corp. Bus 001 Device 006: ID 046d:c52e Logitech, Inc. Bus 001 Device 005: ID 0489:e04e Foxconn / Hon Hai
可以看到端口为9025就是小米手机,“Bus 003 Device 006: ID 18d1:9025 Google Inc. ”
参考: