30

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.

  • 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 '17 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. – Nadav Tasher Apr 24 '17 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 '17 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. – Nadav Tasher Apr 24 '17 at 10:24
  • How about running it as root and just changing the settings and sdk appropriately. – shmink Apr 24 '17 at 10:26

11 Answers 11

43

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
  • 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 '17 at 19:47
38

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

  • 3
    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 '17 at 6:31
  • 1
    This should be the correct answer (not adb restart server) – RumburaK Mar 7 '18 at 10:50
  • Correct answer for me. – Alvaro Gutierrez Perez Apr 28 '18 at 6:07
  • should not be the correct answer but worked. – Uzumaki D. Ichigo Aug 12 '18 at 10:32
  • Yes, this is the correct answer. – ExtraT Mar 8 at 16:25
27

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

  • This answer solved my problem. Perfect, thanks. – alexmeia Apr 3 '18 at 15:15
  • Thanks @Paul It helped me. Well explained with reason. I think udev service restart is also required. – Gagan Apr 18 '18 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 '18 at 14:02
  • 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 '18 at 21:57
  • 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 '18 at 9:28
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.

  • 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. – Nadav Tasher Apr 24 '17 at 10:17
  • Tried deleting all host authorizations? Rebooted after that? – Joel G Mathew Apr 24 '17 at 10:17
  • didn't reboot. i'll try that and tell you if it worked. – Nadav Tasher Apr 24 '17 at 10:22
  • If it worked, you can accept the answer. – Joel G Mathew Apr 26 '17 at 13:06
  • ill check later today – Nadav Tasher Apr 26 '17 at 13:18
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.

  • thank you very much, although it was a bug fixed by a system update (on phone) and studio update. – Nadav Tasher Aug 17 '17 at 20:08
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

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

1

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.

0

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.

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).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.