Before being able to take screenshots of an Android device connected via USB cable to a machine running Ubuntu 12.04, it is necessary to instruct Ubuntu to give the user full permissions over the device. Unfortunately the tutorials that I found on the web didn’t work, so here is what has worked for me.
- Connect the device and get the vendor and product ID by running
lsusb
in a console.
The output should contain one line listing your Android device, similar to the following:Bus 002 Device 004: ID 18d1:4e22 Google Inc. Nexus S (debug)
Note the two 4 character hex values separated by a colon behind ID, these the vendor ID and product ID for your device.
- With a text editor, create/edit the file
/etc/udev/rules.d/51-android.rules
and place the following text in it:
SUBSYSTEM=="usb", ATTRS{idVendor}=="VENDORID", ATTR{idProduct}=="PRODUCTID", MODE="0666"
Replace VENDORID and PRODUCTID with the values retrieved in step 1. Save the file and close the editor.
- Disconnect your device.
- Kill your Android debug server if it was running by executing
./platform-tools/adb kill-server
from console in the Android SDK directory.
- Restart the udev subsystem to let it detect the rule created in step 2 with
sudo service udev restart
- Reconnect your device.
- Run
./tools/ddms
from console in your Android SDK directory to bring up the Dalvik Debug Monitor (DDM).
- In DDM, select your device in the top-left device list, wait a few seconds, then select “Device -> Screen Capture” from the application menu.