How to configure ADB access for Android devices?

Please read the following first: How do I set up Android ADB?


Configuring USB access

First, you don't need root permissions to run ADB if you have set the permissions accordingly. The AOSP site provides examples for Configuring USB Access for Pixel/Nexus devices. You can use the following scheme for non-Nexus devices:

SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", ATTR{idProduct}=="xxxx", MODE="0600", OWNER="<username>"

Vendor and product ID can be obtained by using lsusb and searching for your device. (Note: The device actually is a Galaxy Nexus.)

$ lsusb | grep -i samsung
Bus 002 Device 103: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II]

So my /etc/udev/rules.d/51-android.rules udev rule looks like this:

# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="username"

You may want to repeat this for the other phone states like fastboot if needed. To let the changes take effect either reload udev (sudo udevadm control --reload) or reboot (recommended).

Making programs available

Instead of modifying the path variable I would suggest adding a symbolic link to the executable either in ~/bin/ (user only) or in /usr/local/bin/ (system wide).

mkdir ~/bin/
ln -s /opt/android-sdk-linux/platform-tools/adb ~/bin/

I bumped into the same issue with a tablet from China (some weird manufacturer).

In addition to /etc/udev/rules.d/51-android.rules file, I needed to change ~/.android/adb_usb.ini as well.

Run below on terminal;

sudo gedit ~/.android/adb_usb.ini

and your adb_usb.ini file should look like:

# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
# ie 0x2207
0x<!!!Your Vendor ID here!!!>

Disconnected and reconnected device and also needed to run below commands on terminal;

adb kill-server

and afterwards

adb start-server

And the device was detected.


In my case instead of MTP mode some Smartphones needed just to be set in PTP mode unlike most devices who required MTP mode to be detected by my Android Studio (v1.5.1).

So be sure to first try both MTP and PTP modes before without need spending time to the more complex ADP Configuration of Unix and maybe harming them.

In newer devices you can choose it directly at Dev options, while in older it is in the USB Connected Options on the Status Bar.

Yet also for me the newest Sony Xperia Devices from Z5 and above, will not work no matter the USB mode. Maybe my Android Studio is old or I need to dig also with the Unix ADP Configurations.