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