Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.