Skip to content

Instantly share code, notes, and snippets.

@wmbest2
Forked from scottferg/adb_install.sh
Created August 17, 2011 19:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmbest2/1152387 to your computer and use it in GitHub Desktop.
Save wmbest2/1152387 to your computer and use it in GitHub Desktop.
Small shell script to easily deploy an Android debug build to all connected devices using adb
#!/bin/bash
file="bin/*-debug.apk"
uninstall=0
while getopts "ruf:" opt; do
case $opt in
r)
file="bin/*-release.apk"
;;
u)
uninstall=1
;;
f)
file=$OPTARG
;;
esac
done
for x in `adb devices | awk '/device$/ {print $1}'`; do
if [ $uninstall -eq 1 ] ; then
package=`aapt dump badging $file | awk '/package:/ {print $2}' | sed -e 's/name='\''\(.*\)'\''/\1/g'`
echo `adb -s $x uninstall $package`
else
echo `adb -s $x install -r $file`
fi
sleep 0;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment