26

Five days ago I installed Android Studio on a fully updated Ubuntu 2018.04, used the wizard to create an example app, pressed the "Run" button and it ran perfectly on my Android device connected via USB.

Today, on the same Ubuntu and with the same deviced plugged in, I opened the same project and pressed "Run" again. It now fails:

Launching Application
$ adb push /home/nico/src/ActionBarCompat-Basic/Application/build/outputs/apk/debug/Application-debug.apk /data/local/tmp/com.example.android.actionbarcompat.basic
com.android.ddmlib.AdbCommandRejectedException: insufficient permissions for device: user in plugdev group; are your udev rules wrong?
See [http://developer.android.com/tools/device.html] for more information
Error while Installing APK

I did not knowingly modify any Ubuntu configuration or even update the OS.

What could be the problem?
How to investigate further?

39

This procedure solves the problem for me:

  • On the Android device, drag the top menu and select "USB for file transfer"
  • Press "Run" again

It might be accidental, but it has always (about 50 times) worked so far.

In recent versions of Android, the name of the menu and choice item has changed a bit, but it still works for me.

  • 2
    Thanks! It works for me. When i choose only USB debugging it not work, but when i choose USB file transfer, the app run instantly. – Pramod Gharu Nov 13 '18 at 10:02
16

In short: The group of the USB device is root, not plugdev.

Adding a file /etc/udev/rules.d/51-android.rules

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

(lsusb18d1:d002)

And plugging in and out did the work for me. Now, the device is in the plugdev group.

(source)

  • This solves the issue for me – dmSherazi Jan 9 at 8:59
6

I was receiving a similar error due to udev rules not being configured:

kirk@laptop:~$ adb devices
List of devices attached
FA7240300631    device
FA7240300631    no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]

I was able to work around this by running:

adb kill-server && adb start-server

but this was not at all ideal. I fixed it by installing:

sudo apt install android-tools-adb

Which is a community-maintained default set of udev rules.

source

0

As one of them mentioned, removing the USB cord from the laptop and re-connecting it did the trick for me. (I may have enabled the USB Debugging option after I connected it the first time, hence the error)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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