个人工具

UbuntuHelp:AndroidScreenshots

来自Ubuntu中文

跳转至: 导航, 搜索

Taking Android phones screenshots from Ubuntu

Note: this guide has been tested with Ubuntu 9.04 and 9.10. If you have information for other versions, please add it. There is no functionality to take screen captures from your Android phone as part of the default setup. You will need a separate computer running the Davik Debug Monitor (DDMS). This guide explains how to install the required software and prepare Ubuntu to take screenshots of your 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. Download the Android SDK for Linux. The current version as of this writing is Android 1.5 SDK, Release 2. You should have a file named android-sdk-linux_x86-1.5_r2.zip or similar
  2. Uncompress the file by right-clicking on the archive file and clicking Extract Here, or use unzip android-sdk-linux_x86-1.5_r2.zip 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"
  3. Save the file and run the following command:
    gksudo service udev restart
    
  4. 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:

AndroidScreenshots?action=AttachFile&do=get&target=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: AndroidScreenshots?action=AttachFile&do=get&target=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: <
    >AndroidScreenshots?action=AttachFile&do=get&target=Screenshot-Android+SDK+.png
  4. After answering to the data-gathering question, DDMS should start and show your device on the left pane:<
    > AndroidScreenshots?action=AttachFile&do=get&target=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: AndroidScreenshots?action=AttachFile&do=get&target=ddms-screencap.png