Skip to content

Instantly share code, notes, and snippets.

@ivanarellano
Last active March 27, 2023 17:43
Show Gist options
  • Save ivanarellano/b02df51874c23125ab7993d84483cce9 to your computer and use it in GitHub Desktop.
Save ivanarellano/b02df51874c23125ab7993d84483cce9 to your computer and use it in GitHub Desktop.
ADB Screencap and Screenrecord Commands on Android 4.4+

Screencap Command Usage

  1. adb shell screencap /sdcard/screencap.png
  2. adb pull /sdcard/screencap.png
  3. (Optional) Delete the file: adb rm /sdcard/screencap.png

Screenrecord Command Usage

  1. adb shell screenrecord /sdcard/screenrecord.mp4
  2. Press Ctrl + C on Mac to stop recording
  3. adb pull /sdcard/screenrecord.mp4
  4. (Optional) Delete the file: adb rm /sdcard/screenrecord.mp4

Recap

How to Use ADB With an Emulator Instance or Connected Device

  • When only a single emulator instance is connected: adb
  • When only a single connected device is connected: adb -d
  • When we want to connect to a device using a serial number or qualifier name: adb -s [serial/name]

How to Get Attached Device Serial Number or Qualifier Name

  1. Connect a real device or run an emulator to connect with ADB.
  2. Use adb devices to retrieve a list attached of devices.
@francoisnicolas
Copy link

adb pull /sdcard/screencap.png

@ivanarellano
Copy link
Author

adb pull /sdcard/screencap.png

👍 Changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment