Linux环境下配置真机测试
1 将测试机和开发机通过usb连接
2 通过命令查看usb连接情况
Bus 008 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 003 Device 013: ID 12d1:1038 Huawei Technologies Co., Ltd. Ideos (debug mode
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 0461:4e04 Primax Electronics, Ltd
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 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
3 查找你的手机所连接端口的ID
注意红色代码显示现在连接的是华为真机,那么读取ID为:12d1
sudo gedit /etc/udev/rules.d/android.rules
以上面华为为例,ID为12d1为例,在android.rules输入下面这一行
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
如果你换测试机,还可以把下面所有型号全部输入,就不用每次都重复工作。如下:
#Acer 0502
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
#Dell 413c
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
#Foxconn 0489
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
#Garmin-Asus 091E
SUBSYSTEM=="usb", SYSFS{idVendor}=="091e", MODE="0666"
#HTC 0bb4
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
#Huawei 12d1
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
#Kyocera 0482
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
#LG 1004
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
#Motorola 22b8
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
#Nvidia 0955
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
#Pantech 10A9
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
#Samsung 04e8
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
#Sharp 04dd
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
#Sony Ericsson 0fce
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
#ZTE 19D2
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"
5 改变文件权限,并重启usb服务
sudo chmod a+rx /etc/udev/rules.d/android.rules
重启
sudo /etc/init.d/udev restart
6 重启adb服务
sudo adb kill-server
同样在目录sdk/platform-tools 中,输入Shell代码
sudo adb devices
7 大功告成,开启真机测试吧。