When reading the SDK help documentation, I found that the SDK has provided instructions. In this way, you can avoid the File Permission of ADB pull being root.
For details, see Docs/GUIDE/developing/device.html.
If you're developing on Ubuntu Linux, you need to add a rules file that contains a USB configuration for each type of device you want to use for development. each device manufacturer uses a different vendor ID. the example rules files below show how to add an entry for a single vendor ID (the HTC vendor ID ). in order to support more devices, you will need additional lines of the same format that provide a different value forSYSFS{idVendor}
Property. For other IDs, see the Table of USB vendor IDs, below.
- Log in as root and create this file:
/etc/udev/rules.d/51-android.rules
.For gusty/hard, edit the file to read: [Note: Ubuntu 7.10 and later versions]
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
For dapper, edit the file to read: [Note: Ubuntu 6.06 and earlier versions]
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
- Now execute:
chmod a+r /etc/udev/rules.d/51-android.rules
Create a file in the/etc/udev/rules. d/directory as instructed.51-android.rules, change 0bb4 to the corresponding USB, and the supplier ID is enough.
For example, if my mobile phone is Motorola and idvender is
22b8
So this line is
SUBSYSTEM=="usb", SYSFS{idVendor}=="
22b8
", MODE="0666"
However, you can write multiple lines to use various devices. For example, if I write all the files, my files are as follows:
# ACS 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"
However, according to the above IDs, none of them can be included. the usb id of one of my devices is not listed above.
You can easily use the lsusb command to view your USB ID
Shily @ hh-desktop :~ $ Lsusb
Bus 002 device 003: Id 413c: 2003 Dell Computer Corp. keyboard
Bus 002 device 002: Id 0461: 4d22 primax electronics, Ltd
Bus 002 device 001: Id 1d6b: 0001 Linux Foundation 1.1 root Hub
Bus 001 device 010: ID18a10002
Bus 001 device 001: Id 1d6b: 0002 Linux Foundation 2.0 root Hub
Find the ID above is18a1Add my device to the file.
Subsystem = "USB", sysfs {idvendor} = "18a1", mode = "0666"
Modify/etc/udev/rules.d/51-android.rules
You do not need to restart the Linux machine. Just re-plug the device. Run ADB devices again to see that your device is connected.
Shily @ hh-desktop :~ $ ADB Devices
List of devices attached
0403502001011000 Device
Before that, what you see is
Shily @ hh-desktop :~ $ ADB Devices
List of devices attached
???????????? No Permissions
Read the help document of the ADB command to learn more about the ADB command.