7

In the past I've never had to set this up, but I updated Android Studio to version 2.3.1 today and got this error when clicking debug:

05/03 17:19:19: Launching app
$ adb push app-debug.apk {path on my computer}
com.android.ddmlib.AdbCommandRejectedException: insufficient permissions for device: verify udev rules.
See [http://developer.android.com/tools/device.html] for more information.
Error while Installing APK

I went to the page they specified, where they told me to make the file /etc/udev/rules.d/51-android.rules

So I did, adding this line:

SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"

For my (Huawei) Nexus 6P.

I also added the debug section to build.grade, as they specified.

However, I still get the same error. I tried substituting my own linux user group in place of plugdev, but that didn't fix the issue either. Any suggestions?

PoisonRain
  • 323
  • 1
  • 7
  • 14

2 Answers2

8

be aware that it might report different IDs, depending on the current USB mode of the device.

therefore it's important is to enable USB debugging first ...

and then use lsusb in order to obtain the vendor & product IDs ...

Bus 001 Device 070: ID 18d1:4ee7 Google Inc.

the culprit might be the vendor ID, where 12d1 is Huawei - and 18d1 is Google.

... whatever lsusb outputs goes to udev rules:

# angler (Nexus 6P)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0600", OWNER="yourusername"

then run:

sudo udevadm control --reload-rules
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
0

You probably did not add the proper ATTR{idVendor} attribute. To do that, do the following:

$ sudo adb devices
List of devices attached
adb server is out of date.  killing...
* daemon started successfully *
XXXXyyyy    device
  1. After running adb devices you'll see the output above.

  2. Copy the first 4 bytes of the device output (so, XXXX). Replace those with ATTR{idVendor}=="XXXX" in /etc/udev/rules.d/51-android.rules and restart udev.

As the comment below indicated, the above method may not work; another option is to use lsusb or tail dmesg.

  • This doesn't always work. The `XXXXyyyy` in `adb` might not be the device ID. Use `dmesg` to find out the device ID and add that to your rules. – Bart Friederichs Jan 17 '19 at 14:12