Coder Perfect

set up device for development (???????????? no permissions)


I’m using an Android 4.0-based Samsung Galaxy Nexus phone.

On Ubuntu Linux, I’m working on an Android app. I wanted to launch my software directly on the Samsung mobile device, thus I went through the following steps:

Then, on my computer, I opened a terminal and typed in the adb devices command, which returned the following:

List of devices attached 
????????????    no permissions

Because I couldn’t find my device but only???????????? I then run the following commands with no permissions:

 adb kill-server
 adb start-server
 adb devices

But here’s what I got:

List of devices attached 
????????????    no permissions

Why? What am I overlooking?

Asked by Leem.fin

Solution #1

I’ve found that killing and restarting the adb server works best for me. Sudo adb kill-server, then sudo adb start-server on Linux. Then, right out of the box, it will detect practically every device.

Answered by WarrenFaith

Solution #2

Nothing worked for me until I discovered the solution here:

I’m copying the text into this document in case it vanishes in the future.

Make a file called /tmp/android.rules with the following contents (the hex vendor numbers came from the vendor list page):

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1bbb", MODE="0666"

Execute these commands:

sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules
sudo chmod 644   /etc/udev/rules.d/51-android.rules
sudo chown root. /etc/udev/rules.d/51-android.rules
sudo service udev restart
sudo killall adb

Disconnect the phone’s USB cable from the computer’s USB port.

Reconnect the phone.

Run adb devices to validate that it now has access to the phone.

Please note that you can use, USER=”$LOGINNAME” in the.rules file instead of, MODE=”0666,” substituting $LOGINNAME for your login name, which is what id -nu prints.

In some circumstances, such as z51-android.rules, it may be required to provide the udev rules file a name that sorts toward the end.

Answered by grebulon

Solution #3

Use the following instructions to get started:

# cd to adb for sudo
cd `which adb | sed -e "s/adb//"`
adb kill-server
sudo ./adb start-server
./adb devices

This happens when you are not running adb server as root.  

Answered by iancrowther

Solution #4

I tried everything above and it didn’t work… until I switched the connection from MTP to Camera and it worked (PTP).

Answered by Sabeer

Solution #5

There are a lot of bad answers posted to this question ranging from insisting on running adb as root (which should not be touted as the only or even recommended solution) to solving completely unrelated issues.

Here is the single shortest and most universal recipe for taking care of permissions for all adb and fastboot devices at once:

echo 'ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:ff420?:*", MODE="0666"' | sudo tee /etc/udev/rules.d/99-android.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --verbose --action=add --subsystem-match=usb

You could also go with a somewhat longer variation. I made a comment on this gist.

The exact point that the OP missed in his inquiry was not reloading the udev rules after making changes to the.rules file.

Also, the OP did not specify which Android build (also known as ROM) he had installed on his phone. Because the idVendor value is set in software, it is dependent on the ROM. As a result, the figure of 04E8 he used in his initial rule would have only worked on Samsung stock ROM devices. This isn’t an issue for this udev rule because it matches any devices having adb or fastboot interfaces, regardless of VendorID.

Answered by Alex P.

Post is based on