I have 7 devices plugged into my development machine.
Normally I do adb install
and can install to just a single device.
Now
You can use adb devices
to get a list of connected devices and then run adb -s DEVICE_SERIAL_NUM install...
for every device listed.
Something like (bash):
adb devices | tail -n +3 | cut -sf 1 -d " " | xargs -iX adb -s X install ...
Comments suggest this might work better for newer versions:
adb devices | tail -n +2 | cut -sf 1 | xargs -iX adb -s X install ...
For Mac OSX(not tested on Linux):
adb devices | tail -n +2 | cut -sf 1 | xargs -I {} adb -s {} install ...
Generalized solution from Dave Owens to run any command on all devices:
for SERIAL in $(adb devices | grep -v List | cut -f 1);
do echo adb -s $SERIAL $@;
done
Put it in some script like "adb_all" and use same way as adb for single device.
Another good thing i've found is to fork background processes for each command, and wait for their completion:
for SERIAL in $(adb devices | grep -v List | cut -f 1);
do adb -s $SERIAL $@ &
done
for job in `jobs -p`
do wait $job
done
Then you can easily create a script to install app and start the activity
./adb_all_fork install myApp.apk
./adb_all_fork shell am start -a android.intent.action.MAIN -n my.package.app/.MainActivity