xb9xaq
Last Updated: February 25, 2016
·
817
· carlosefonseca

Take a screenshot of every Android device attached via adb

Wanting to take a screenshot of all the different Android devices you have that are attached to adb, probably showing of the handling of different screen sizes? Use this:

adb devices | grep -v List | grep device | perl -p -e 's/(\w+)\s.*/\1/' | xargs -I § sh -c 'adb -s "$1" shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "screen_$1.png" && open "screen_$1.png"' -- §

I have a function on .bash_profile with it.

This is a mix with another useful line that runs some adb command on all devices:

function adball {
    adb devices | grep -v List | grep device | perl -p -e 's/(\w+)\s.*/\1/' | xargs -I § adb -s § "$@"
}

Do:
adball install -r app.apk

and it installs on every device! Cool!

I have some more of these stuff here https://github.com/carlosefonseca/AndroidShell