AdbCommandRejectedException: insufficient permissions for device: user in plugdev group; are your udev rules wrong?

25,953

Solution 1

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.

Solution 2

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)

Solution 3

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

Solution 4

Complet Instruction Ubuntu 18 + Android 10

This is how I did

  • Disconnect your phone from the USB cable and enter lsusb to list all USB devices
  • Now connect your phone with a USB cable and reenter lsusb.
  • You can now see the new device added to the device list.

    Copy the device ID from the terminal. ID is shown as the first part: second part

For Example,for below device ID here is 2a70:4ee7

Bus 001 Device 007: ID 2a70:4ee7

  • Edit the Udev rules using nano

    sudo nano /etc/udev/rules.d/51-android.rules

  • Add this line at the bottom of the file. Replace 2a70 and 4ee7 with your first and second part of your device ID

SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", ATTR{idProduct}=="4ee7", MODE="0666", GROUP="plugdev"

  • Control+X to save
  • Y to Yes

  • Now reload dev rules

sudo udevadm control --reload-rules

  • Disconnect and reconnect the Android phone
  • Accept debugging from the Dialog

That's it it should be working now

Share:
25,953

Related videos on Youtube

Nicolas Raoul
Author by

Nicolas Raoul

I am Nicolas Raoul, IT consultant in Tokyo. Feel free to copy/paste the source code from my StackExchange answers, I release it to the public domain.

Updated on September 18, 2022

Comments

  • Nicolas Raoul
    Nicolas Raoul over 1 year

    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?

  • Pramod Gharu
    Pramod Gharu over 5 years
    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.
  • dmSherazi
    dmSherazi over 5 years
    This solves the issue for me