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?
Without unplugging
All the provided answers assume that you are able to unplug and reconnect the USB cable. In situations where this is not possible (e.g., when you are remote), you can do the following to essentially do what the suggested udev rules would do on re-plug:
Find the device you care about, e.g.:
Take note of the bus number it is on and then execute, e.g. for bus
003
:Clearly this may be more permissive than you want (there may be more devices attached than just this one), but you get the idea.
Try instead of
GROUP="plugdev"
use the main group of your user.There are a lot of bad answers posted to this question ranging from insisting on running
adb
asroot
(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
andfastboot
devices at once: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 of04E8
he used in his original rule would have worked only for devices with Samsung stock ROMs. But this is not a problem for thisudev
rule - it matches all devices withadb
orfastboot
interfaces regardless of their VendorID.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.
Tried all above, none worked .. finally worked when I switch connected as from MTP to Camera(PTP).