Screenshot of Android device using command line

Source: Internet
Author: User
2013-08-26 Black Day White month Posted in Android, tipstagged as Androidrss

The average Android user knows to press the volume reduction and the power button screen capture at the same time, but as a developer, it may take a simpler way to save the screenshot to the development computer.

This method only needs to execute a command at the terminal, involving invoking the Screencap tool built into the system:

ADB Shell Screencap-p | Sed ' s/\r$//' > Screen.png

Screencap itself supports standard output, so it can be piped linked. But the ADB shell converts the LF in the result to CR+LF (for compatibility reasons). , the PNG format is corrupted. So here you use the row editor sed to remove the CR before LF.

If you use OS X, you can also use Perl to achieve similar effects:

ADB Shell Screencap-p | Perl-pe ' s/\x0d\x0a/\x0a/g ' > Screen.png

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.