📜  adb screenshot (1)

📅  最后修改于: 2023-12-03 14:39:01.570000             🧑  作者: Mango

ADB Screenshot

Introduction

ADB (Android Debug Bridge) is a versatile command-line tool that allows developers to communicate with an Android device or emulator. One of the useful features of ADB is the ability to take screenshots using the adb screenshot command. This command captures the current screen of the connected Android device or emulator and saves it as an image file on the computer.

Usage

To take a screenshot using ADB, follow these steps:

  1. Connect your Android device to your computer using a USB cable. Make sure USB debugging is enabled on your device.
  2. Open the command prompt or terminal on your computer.
  3. Navigate to the platform-tools directory of the Android SDK installation folder.
  4. Run the command adb devices to verify that your device is detected by ADB.
  5. Once your device is recognized, execute the command adb screenshot.

For example:

adb screenshot

This will capture the current screen of the connected device and save it as a PNG image file in the platform-tools directory.

Additional Options

The adb screenshot command also provides some additional options to customize the screenshot capturing process. Here are some commonly used options:

  • -d <device>: Specifies the device to capture the screenshot from when multiple devices are connected.

    adb -s <device> screenshot
    
  • -e <file>: Specifies the file to save the screenshot as.

    adb screenshot -e path/to/save/screenshot.png
    
  • -p: Displays the path of the saved screenshot file on the computer.

    adb screenshot -p
    
  • -s: Capture the screenshot and display it on the screen without saving it as a file.

    adb screenshot -s
    
  • -r <scale>: Specifies the scaling factor for the screenshot. The default value is 1.0.

    adb screenshot -r 0.5
    
Conclusion

The adb screenshot command is a powerful tool for capturing the screen of an Android device or emulator. Its flexibility and additional options make it a handy utility for developers to take screenshots for debugging, testing, or documenting purposes.