I have 7 devices plugged into my development machine.
Normally I do adb install <path to apk>
and can install to just a single device.
Now I would like to install my apk on all of my 7 connected devices. How can I do this in a single command? I'd like to run a script perhaps.
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 ...
Thanks! Unfortunately I was unable to get the script to run. I am not an expert at shell scripting. I get the error:
xargs: illegal option -- i usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr] [-L number] [-n number [-x]] [-P maxprocs] [-s size] [utility [argument ...]]
Try replacing
-iX
with-I X
Did you replace
...
with your APK name? Try replacing the whole lastadb
call withecho X
to make sure it prints out values you'd expect.adb devices | tail -n +3 | cut -sf 1 -d " " | xargs -I X echo X -s X install SONR
doesn't print anything outWhat about
adb devices
? Does adb even see your devices?