Small shell script to easily deploy an Android debug build to all connected devices using adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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