Taking Android phones screenshots from Ubuntu

Note: this guide has been tested with Ubuntu 9.04 , 9.10 and 10.04. If you have information for other versions, please add it.

This guide explains how to install the required software and prepare Ubuntu to take screenshots of your phone. If your device is NOT running Android 4.0 (Ice Cream Sandwich), then there is no way to take screen captures from the device itself, and this is by design, unless you "root" your phone. The focus of this guide is on getting screenshots from non-rooted devices.

There are two ways to take screenshots on your Android phone:

Installing the Android SDK

IMPORTANT: Other guides mention installing Eclipse and Android development plugins, however this is not necessary if you only want to get screenshots from your device (as opposed to actually develop an application for it).

  1. If using Ubuntu 10.04LTS, install the openjdk-6-jdk package using the Ubuntu Software Center, Synaptic or command line.

  2. Download the Android SDK for Linux. The current version as of this writing is Android r06. You should have a file named android-sdk_r06-linux_86.tgz or similar

  3. Uncompress the file by right-clicking on the archive file and clicking Extract Here, or use tar -xzvf android-sdk_r06-linux_86.tgz from command line.

Setting up UDEV rules to grant access to your phone.

  1. Ubuntu won't allow the DDMS access to the Android phone via USB unless the appropriate udev rule is set. This is Bug #316215. In order to provide such rule, you need to create a rule file as root. From Applications > Accessories > Terminal:

    gksudo gedit /etc/udev/rules.d/90-android.rules
  2. Once the text editor comes up, insert the following in that file:

    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"

    on some recent UDEVs this has changed to

    BUS=="usb", SYSFS{idVendor}=="0bb4", OWNER="MACHINEUSERNAME", GROUP="USERGROUP"

where you replace the owner and group with your own. No idea how to set this up on multiple users, probably multiline

  • (Note: The vendor id will may be different, depending on specific vendor)

  • Save the file and run the following command:

    gksudo service udev restart
  • Exit the terminal.

If your phone is already connected, you will need to unplug it and plug it again for this to apply.

The above permission effectively grant access to your phone to any other users on the same system. This isn't a problem unless the system you connect your phone to has other users. See Bug #316215 for more details.

Enabling USB debugging mode on your phone

  1. Go to the Settings application, then Applications > Development.

  2. Mark the USB Debugging checkbox:

device-usb.png

Connecting the phone via USB

  1. Connect your phone via USB, without mounting the SD card as mass storage. Only the original cable will work.

Your notification area should look like this:

device-usb2.png

Starting DDMS for the first time, taking screenshots

  1. Navigate to the directory where you extracted the Android SDK, locate the tools directory

  2. Double-click on ddms.

  3. You'll be asked if you want to share usage information:
    Screenshot-Android SDK .png

  4. After answering to the data-gathering question, DDMS should start and show your device on the left pane:
    ddms.png

Once DDMS has been installed and your device is visible within it, you can click on it and then go to Device > Screen Capture or simply press Ctrl-S and the capture dialog will show your current phone display, allowing to Refresh, Save or quit by clicking Done:

ddms-screencap.png

AndroidScreenshots (last edited 2012-03-03 17:07:07 by drummer-aidan)