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.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityHad same problem. Ensuring that device USB mode is NOT charging only has solved it.
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
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.
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
Changing the USB Mode from Phone did the trick for me. (I set it to File Transfer.)
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.
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.
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.
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.
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.
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.
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.
Go to Settings >> Maintenance >> Storage. Then check the top left menu and click on USB computer connection then change to Media device (MTP).
https://developer.android.com/studio/run/device
plugdev
group: sudo usermod -aG plugdev $LOGNAME
sudo apt-get install android-sdk-platform-tools-common
If it's still not working, try to:
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).
sudo adb devices
. If that works great but from memory I've not had to be root to check for devices attached.