ADB and Nexus 4 - Linux

When I plug my Nexus 4 into my Xubuntu VM and run adb devices, it displays the following

????????????    no permissions

I don't remember facing this problem with my Nexus 10, but I might have done something to fix it and just can't remember. That's another good reason to have started this blog cause every time I run into a problem I usually end up with about 10+ browser tabs all with different Google search results on how to fix the problem and then forget how I did it. Anyway, here are the two that worked for me.

Running the adb daemon as root

Found here

sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb devices

Adding a udev rules file

The developer guide has a section which shows you how to set up your system to detect your device and provides a list of vendor IDs you can use. I think this solution is more complete as it allows you to figure out your own vendor and device id. So this is what worked for me.

sudo lsusb
Bus 001 Device 004: ID 18d1:d002 Google Inc.
sudo viĀ /etc/udev/rules.d/51-android.rules

Add this line

SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="d002", MODE="0666"

And finally

sudo service udev reload