set up device for development (???????????? no permissions)
Solution 1
What works for me is to kill and start the adb server again. On linux: sudo adb kill-server
and then sudo adb start-server
. Then it will detect nearly every device out of the box.
Solution 2
Nothing worked for me until I finally found the answer here: http://ptspts.blogspot.co.il/2011/10/how-to-fix-adb-no-permissions-error-on.html
I'm copying the text here in case it disappears in the future.
Create a file named /tmp/android.rules with the following contents (hex vendor numbers were taken 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"
Run the following 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 USB cable between the phone and the computer.
Reconnect the phone.
Run adb devices
to confirm that now it has permission to access the phone.
Please note that it's possible to use , USER="$LOGINNAME"
instead of , MODE="0666"
in the .rules
file, substituting $LOGINNAME
for your login name, i.e. what id -nu
prints.
In some cases it can be necessary to give the udev rules file a name that sorts close to the end, such as z51-android.rules
.
Solution 3
Enter the following commands:
# 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.
Solution 4
Tried all above, none worked .. finally worked when I switch connected as from MTP to Camera(PTP).
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
Or you could use slightly longer version I posted to this gist.
As for the specific thing that OP did wrong in his question - it was not reloading the udev
rules after editing the .rules
file.
Also OP did not tell which Android build (aka ROM) he had on his phone. The idVendor
value is set in software and therefore it depends on the ROM. So the value of 04E8
he used in his original rule would have worked only for devices with Samsung stock ROMs. But this is not a problem for this udev
rule - it matches all devices with adb
or fastboot
interfaces regardless of their VendorID.
Related videos on Youtube
Comments
-
Leem.fin about 2 years
I am using a Samsung galaxy nexus phone (Android 4.0 platform) .
I am developing Android app on Ubuntu linux OS. I would like to run my application directly on the Samsung handset device, so I performed the following setup steps:
in my project
AndroidManifest.xml
file, addedandroid:debuggable="true"
to the<application>
elementOn the device, in the Settings > Security enabled Unknown sources
On the device, in the Settings > Developer options enabled USB debugging
On my computer, created the
/etc/udev/rules.d/51-android.rules
file with the following content:SUBSYSTEM=="usb", ATTR{idVendor}=="04E8", MODE="0666", GROUP="plugdev"
On my computer, run the
chmod a+r /etc/udev/rules.d/51-android.rules
command
Then, on my computer I opened a terminal and executed the
adb devices
command, I got:List of devices attached ???????????? no permissions
Since I did not see my device but only
???????????? no permissions
, I then run the following commands:adb kill-server adb start-server adb devices
But I still got:
List of devices attached ???????????? no permissions
Why? What am I missing?
-
Andro Selva over 12 yearsafter exectuing adb kill-server did u get the message that * daemon not running. starting it now on port 5037 * * daemon started successfully * --- if not try it till u get this msg
-
Sergey Glotov over 12 yearsTry to check that your user is in
plugdev
group. -
Confused over 8 yearsRun =>sudo adb start-server (Use root access to run adb)
-
Abdulrahman Gamal over 4 yearsfinally i found the solution which worked for me in this link github.com/snowdream/51-android
-
bsautner over 2 yearsplease see my 2022 update to this problem wayyy down below and a quick comment that some of the really old solutions here can brick a linux system.
-
Leem.fin over 12 yearsI am using my username, it does not help
-
Leem.fin over 12 yearsI use root to execute command "adb devices" under <android-SDK>/platform-tool/ , I got "No command 'adb' found", why?
-
WarrenFaith over 12 yearscould you paste the exact command you use? I use
sudo /opt/android/platform-tools/adb devices
-
Leem.fin over 12 yearsI use the same syntax command. "sudo /PATH_TO_ANDROID_SDK/platform-tolls/adb devices" It does not help
-
WarrenFaith over 12 yearsmake sure that your adb got +x
-rwxrwxr-x 1 martin martin 156K 2011-11-09 15:40 adb
. Try to move to the directory directly and start via "sudo ./adb devices". If you can run that without sudo, you should be able to run it with sudo... I am not sure what your issue might be... -
Eduard Luca over 11 yearsNote: for Ubuntu Precise the filename is
70-android.rules
as per this post: esausilva.com/2010/05/13/…. Also kudos for letting us know you have to restartudev
and kill all adb processes. Worked like a charm! -
gnac over 11 yearsYou should not need to run adb as root if your udev permissions are set correctly. See grebulons answer below, or reference the android documentation: developer.android.com/tools/device.html
-
WarrenFaith over 11 yearsProbably, but why maintaining a list if you could just use root? I have zero interest in adding a rule to it just because I test on a different device. If you just use one, no problem but with a laptop running around on conferences or with a huge amount of devices at work? No thank you.
-
Pijusn over 11 yearsIn case you can't manage to login using
su
, usesudo su
. I did. And also, if you don't know how to quit the user - useexit
. -
bjunix over 10 yearsA similar approach is officially documented at developer.android.com/tools/device.html
-
androidevil over 10 yearsOne important suggestion is disconect the usb cable, so you reset adb, conect the cable and it works. In my situation, while I did the procedure with the cable connected it does not work for me.
-
l.cotonea over 10 yearsHi! Here a short script shell (tested on Linux Mint) that make the job previously described: Script shell to adb reset
-
Dmitry Koroliov almost 10 yearsthough the idea is the same as in the accepted answer, this one only helped me, due to the provided example. Thanks
-
sandino over 9 yearsThis worked thanks, it has every type of device, maybe people fails in putting the rigth idVendor, for that you can put lsusb to see what the numbers is, but this almost exausthive list work great for most people
-
serjlee over 9 yearsThis worked well but, as noted by @luciana in another answer, you might need to call
sudo udevadm control --reload-rules
to refresh udev rules if restarting the server isn't enough. -
Superbiji over 9 yearsYou will need to add: , GROUP="plugdev" device detected successfully under ubuntu 14.04
-
wieczorek1990 over 9 yearsYou can use ATTR instead of ATTRS.
-
Asim over 9 yearsAnd the commands are:
adb kill-server
sudo adb start-server
to check:adb devices
-
Honza about 9 yearsFor Alcatel add:
SUBSYSTEM=="usb", ATTRS{idVendor}=="1bbb", MODE="0666"
-
stan0 about 9 years@user907860 it's actually better than the accepted answer because it explains why you should write sudo :) (which I didn't do when I saw the accepted answer)
-
stan0 about 9 yearsbtw any idea why adb should be running as root?
-
iancrowther about 9 yearssorry no, i dont remember
-
Thaddeus Albers almost 9 yearsFor those wondering how to do this... System settings > Storage > Upper right button: USB computer connection > Connect As Select Camera (PTP) instead of Media device (MTP)
-
hackel over 8 yearsadb should NOT be running as root. If this is required, your system is misconfigured. Stop throwing "sudo" in front of everything, it has huge security implications.
-
Tobias over 8 yearsYour list says ATTRS{idVendor} but developer.android.com/tools/device.html says ATTR{idVendor} (without the 'S'). Which one is correct? (I haven't gotten either to work).
-
lastboy over 8 yearsI'm not sure if that was the only thing that make it work... I tried the above stuff. But w/o this post ubuntu on VBox didn't make my LG G3 authorized. Thank you Keenan
-
Jorius over 7 yearsman, I was looking for the solution like two hours, this works to me on ubuntu 16.04, thanks
-
Zac over 7 yearsThis should be marked as the correct answer, as sudo-ing adb shouldn't be a requirement for Linux
-
user1209216 about 7 yearsThis is the only correct answer here. Thanks for it! Also, we can see lsusb output to make sure required vendor it is included. Most weird, only one of my devices (OnePlus One) suddenly stopped working after upgrading to Android 7.1.2 (even when run adb as root), after adding udev rules as described above, it works again.
-
grebulon about 7 yearsYou need to create the file and copy it to the said location.
-
Alex P. almost 7 yearsto apply the new
udev
rule without reconnecting the device just useudevadm trigger --verbose --action=add --subsystem-match=usb
command. -
Alex P. almost 7 yearsinstead of maintaining the list - just use a single line rule for every Android phone - stackoverflow.com/a/45006231/1778421
-
Tanasis almost 7 yearsDid you maybe mean:
ATTR{idVendor}=="18d1"
-
Alex P. over 6 yearswhy bother with "maintaining the list" when a single rule works for all? stackoverflow.com/a/45006231/1778421
-
Ciro Santilli OurBigBook.com over 6 years@AlexP. thanks I did not know about that method. Any idea why the official guide does not recomment that instead?
-
mstrange over 6 yearsOnly missing step to see it working is adb kill-server before adb devices.
-
Hritik over 6 yearsI don't know why but
sudo adb kill-server; sudo adb start-server
didn't work but this one did. -
Cachapa over 6 yearsThis doesn't seem to work anymore on Android 8.1. How did you find out what adb reports as device id?
-
Amerzilla over 6 yearsWorked for me on Android 7.1.2
-
Alex P. almost 6 years@Cachapa, it works with all Android versions. Even the latest (at the time of me writing this) Android P Preview 4 uses the same adb interface IDs - android.googlesource.com/platform/system/core/+/…
-
Alex P. almost 6 yearsBecause of laziness and knowledge inertia mostly. The original Android developers used devices with the same vendor ID so they took the easiest approach they could think of. When more vendors created more devices - the developers just kept adding more IDs to the rules file.
-
m50 almost 4 yearsthis should be the first thing to check. Works for me
-
Alex P. almost 4 yearsstill works with Android 11 android.googlesource.com/platform/system/core/+/…