Pages

Monday, February 3, 2014

Mass install on android devices via BASH

How to install on all your android devices consecutively

This is the command you copy paste on your bash prompt or script:

for d in $(adb devices | egrep "device$" | sed "s/[[:space:]]device$//");
do
  adb -s $d install -r bin/some.apk;
done

Determine that adb can be accessed from the $PATH variable. That or write out the full path where the adb command is located.

PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"

Happy coding!

P.S. broken-ass implementations of sed like on mac os x don't acknowledge the existence of

[[:space:]]

so, use something like

\s+

or

[\t ]+

and you might have to use sed like this:

sed -e ...

No comments:

Post a Comment

Please help to keep this blog clean. Don't litter with spam.