85

When i try:

$ adb devices

i get the result:

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

what is the problem?

tried on an Ubuntu 16.04 machine and it worked perfectly. tried an 7.1.1 device and it also worked perfectly.

9
  • Try sudo adb devices. If that works great but from memory I've not had to be root to check for devices attached.
    – shmink
    Apr 24, 2017 at 10:13
  • 1
    it wont work with sudo but with root login it will. the problem is that android studio only preforms adb from a non root session, and running it with jksudo it won't recognize my files. Apr 24, 2017 at 10:15
  • I've found the same with android studio and generally anything made by jetbrains. When you installed android studio did you do it as root?
    – shmink
    Apr 24, 2017 at 10:19
  • installed as root to /usr/local/ and chmoded to 777 -R, run not as root so it will recognize settings and sdk. Apr 24, 2017 at 10:24
  • Run android studio as root. If there are changes in settings then change them to how you'd prefer.
    – shmink
    Apr 24, 2017 at 10:30

14 Answers 14

113

Had same problem. Ensuring that device USB mode is NOT charging only has solved it.

3
  • 7
    Same here, I had modified Udev rules with no results , changed USB to file sharing and presto. The device required no udev rules or specific USB modes in the previous ubuntu version.
    – Fco P.
    May 22, 2017 at 6:31
  • 2
    Fixed problem on Fedora for me, thx!
    – F481
    Jul 28, 2019 at 9:32
  • I always forget this and need to search again. Can this be fixed in Ubuntu/Fedora/Android?
    – dreua
    Apr 6, 2021 at 3:52
100

Try to restart the Adb server.

sudo adb kill-server

and then

sudo adb start-server

then connect your device turn Debugging on and type

adb devices
3
  • 2
    This does work.. sort of. After I do that, indeed, running adb devices now shows the device (and I do get the fingerprint dialog). However, it still doesn't work with android studio. Furthermore, when I run android studio, and I then run adb devices from a console, I get a "adb server is out of date" and the adb server restarts. After that, I get to the "no permissions" situation again.
    – Shade
    Aug 17, 2017 at 19:47
  • This does not work. adb devices shows nothing and the headset never asks permission again.
    – Tyguy7
    Oct 15, 2019 at 1:57
  • What solves the issue here is very likely sudo. Restarting the server as a normal user won't work. See @Paul post below for the actual source of the permission issue.
    – jmon12
    Nov 2, 2023 at 13:27
59

Very likely udev is incorrectly adding your device. I too had this problem & came across a relatively simple solution.

Find your device in lsusb

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2b Intel Corp. 
Bus 001 Device 002: ID 05c8:03a2 Cheng Uei Precision Industry Co., Ltd (Foxlink) 
Bus 001 Device 006: ID 18d1:4ee7 Google Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Point of interest in this case:

Bus 001 Device 006: ID 18d1:4ee7 Google Inc.

Check out the corresponding device file

$ ls -l /dev/bus/usb/001/006

Likely you will see something like

crw-rw-r-- 1 root root 189, 5 Sep  8 21:47 /dev/bus/usb/001/006

This which means that the device file will be owned by the user root and the group root, which is why adb can access it as root but not as your standard user.

This can be solved by creating a new udev rule - I used /etc/udev/rules.d/51-android.rules- to add the device to the group plugdev, which adb already assumes you to be a member of (you shoukd be, check using id)

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0660", 
GROUP="plugdev", SYMLINK+="android%n"

**Remember to replace the ATTR{idProduct}=="4ee7" with your own product id that you found out in step one. ** (If your vendor isn't Google Inc., also replace the vendor id with the one before the colon in lsusb).

Now just unplug your device and plug it back in (udev should automatically respond to the new file) and tadaa:

$ adb devices
List of devices attached 
YC873P0G    device

Source: Adding udev rules for USB debugging Android devices - Janos Gyerik

8
  • 1
    This answer solved my problem. Perfect, thanks.
    – alexmeia
    Apr 3, 2018 at 15:15
  • 2
    Thanks @Paul It helped me. Well explained with reason. I think udev service restart is also required.
    – Gagan
    Apr 18, 2018 at 10:16
  • this is most definitely the correct solution if you don't want to use sudo for stuff that you shouldn't need to use sudo for
    – aholt
    Jun 22, 2018 at 14:02
  • 1
    This should be the accepted answer, as it's the correct answer. The highest-rated answer is really just a workaround.
    – Joel Cross
    Sep 9, 2018 at 21:57
  • 1
    This solved it for me. It worked yesterday without the rules, but then after installing updates on ubuntu it stopped working and I had to do this.
    – simernes
    Oct 13, 2018 at 9:28
6

Changing the USB Mode from Phone did the trick for me. (I set it to File Transfer.)

1
  • 1
    This did the trick for me on 2021. Aug 24, 2021 at 14:52
2

You need to provide permission on your Android device. Go to Settings>Developer options. Try turning Usb Debugging off and then on again. Remove the cable and reconnect it. Also try deleting all saved authorizations from Developer options. It should now ask for debugging permission by a prompt on your phone. Accept it.

4
  • doesn't work, i'v already tried it, if it matters, i'm using android 7.1.2, and on another device which is running 7.1.1 it did work. Apr 24, 2017 at 10:17
  • Tried deleting all host authorizations? Rebooted after that? Apr 24, 2017 at 10:17
  • didn't reboot. i'll try that and tell you if it worked. Apr 24, 2017 at 10:22
  • it didn't work. what can i do? Apr 26, 2017 at 16:25
2

To expand Sumeet Deshmukh's answer, his approach does work in general - if you only want to use the adb command from console.

Android Studio, however, apparently starts its own adb server, killing ours. This means that after we have killed/started the server with sudo, Studio restarts it, which leads to the starting situation - no permissions.

The solution is to first start Studio, then perform the start/stop of the server. Doing that, I managed to get my Nexus 5X to show up as a valid run target in Studio.

This isn't the best situation (having to run commands every time you start Studio), but it does the trick in a quick and dirty way. If I find a more permanent solution, I will update this answer.

1
  • thank you very much, although it was a bug fixed by a system update (on phone) and studio update. Aug 17, 2017 at 20:08
2

Please DO NOT follow solutions suggesting to use sudo (sudo adb start-server)! This run adb as root (administrator) and it is NOT supposed to run like that!!! It's a BAD workaround!

Everything running as root can do anything in your system, if it creates or modify a file can change its permission to be only used by root. Again, DON'T!

The right thing to do is set up your system to make the USER have the permission, check out this guide i wrote on how to do it properly.

2

It did not work for me after I added myself to the plugdev group and rebooted the machine just to make sure the change takes effect in all my shell sessions. I then found that there is no 51-android.rules file in /etc/udev/rules.d and had to do the following to fix the problem:

# Here the vendor ID is of Google
$ echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0660", GROUP="plugdev"' | sudo tee —append /etc/udev/rules.d/51-android.rules
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
$ sudo udevadm control --reload-rules
$ sudo service udev restart

I also had to unplug and re-plug my Android device.

1
  • This does not work for me either...
    – Tyguy7
    Oct 15, 2019 at 2:09
1

M0Rf30/android-udev-rules GitHub community maintained udev-rules

https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules

This is the most complete udev-rules list I've seen so far, even more than the currently recommended sudo apt-get install android-tools-adb on the official documentation, give it a try.

1

Make sure you have your udev rules in place, check /etc/udev/rules.d

You can find appropriate rules here: https://raw.githubusercontent.com/M0Rf30/android-udev-rules/master/51-android.rules

Just place them in /etc/udev/rules.d/, then:

sudo udevadm control --reload
sudo udevadm trigger

Now make sure adb server is not running:

sudo adb kill-server

Add your user to adbusers:

sudo usermod -a -G adbusers $USER

Now use su $USER (reference) so that your user actually belongs to adbusers (check using groups)

And then just start adb server again:

adb start-server

In case your device does not appear in adb devices, reconnect it.

1
  • I restart android studio and use "...udevadm..." commands it's helped me. Dec 12, 2019 at 6:05
0

I have no idea why this works, but this was the only solution that worked for me

Find where adb is running (if you are like me you have multiple versions installed). Keep in mind tools like react native may decide to use random other versions in order to make your life harder. For me it's ~/Android/Sdk/platform-tools/adb. So I'll run:

sudo chown root:YOUR_USERNAME ~/Android/Sdk/platform-tools/adb
sudo chmod 4550 ~/Android/Sdk/platform-tools/adb

Android tools are super annoying.

0

Go to Settings >> Maintenance >> Storage. Then check the top left menu and click on USB computer connection then change to Media device (MTP).

0

https://developer.android.com/studio/run/device

  • add yourself to the plugdev group: sudo usermod -aG plugdev $LOGNAME
  • install sudo apt-get install android-sdk-platform-tools-common
  • log out and log in again for the group changes to take effect

If it's still not working, try to:

  • disable and enable "USB-Debugging" on your developer settings of your Android phone
0

I had to do Paul's answer

Then I had to do NuttLoos's answer

THEN I had to take my phone and change USB port from into my keyboard hub, to straight into the computer :face-palm: (This is a Nokia 2.3 that won't work, but a Samsung A10 & a Galaxy Nexus both will work from the Kayboard usb port).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .