Ubuntu18.04配置ADB调试环境

1. 安装adb并运行

apt-get install android-tools-adb
adb start-server

2. 将android设备连接至电脑,通过lsusb命令查看usb设备。粗体是android设备

lsusb

Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 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 003 Device 092: ID 12d1:107e Huawei Technologies Co., Ltd.
Bus 003 Device 004: ID 04ca:7034 Lite-On Technology Corp.
Bus 003 Device 003: ID 093a:2521 Pixart Imaging, Inc. Optical Mouse
Bus 003 Device 006: ID 8087:07da Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

3. 创建adb_usb.ini文件,写入android设备的VID

echo 0x12d1 > ~/.android/adb_usb.ini

4. 添加权限

touch /etc/udev/rules.d/70-android.rules
vi /etc/udev/rules.d/70-android.rules

加入以下内容,注意ATTRS{idVendor}字段对应的是android设备的VID,ATTRS{idProduct}字段对应的是android设备的PID

SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="107e", MODE="0666"

更改文件权限

chmod 666 /etc/udev/rules.d/70-android.rules

5. 重启USB/adb服务

service udev restart
adb kill-server
adb start-server

执行adb devices命令,如有设备则说明adb配置成功了。

adb devices

List of devices attached
SJE0217511001083 device


参考文章
[1] https://blog.csdn.net/u012351661/article/details/78201040

你可能感兴趣的:(ubuntu,ubuntu,android)