As a developer, you will need to take screenshots frequently to share to your team. In this post, let me share you a simple way to screenshot Android device and save the image on Mac.
Prerequisites:
- You already installed adb on your PC (Mac in my case)
- Your phone is being connected to your PC
// Take the screenshot and save to phone's SDCard
// (You can change screenshot.png to any name that you want)
adb shell screencap -p /sdcard/screenshot.png
// Pull/Copy the screenshot to your Mac
adb pull /sdcard/screenshot.png
// Delete the screenshot on your phone (if needed)
adb shell rm /sdcard/screenshot.png
If you want to run just one command (combine above separate commands actually):
// Solution 1: separate commands by "&&"
adb shell screencap -p /sdcard/screenshot.png &&
adb pull /sdcard/screenshot.png &&
adb shell rm /sdcard/screenshot.png
// Solution 2: separate commands by semicolon(s) (;)
adb shell screencap -p /sdcard/screenshot.png;
adb pull /sdcard/screenshot.png;
adb shell rm /sdcard/screenshot.png