Skip to content

Instantly share code, notes, and snippets.

@booknara
Created April 1, 2014 21:28
Show Gist options
  • Save booknara/9923565 to your computer and use it in GitHub Desktop.
Save booknara/9923565 to your computer and use it in GitHub Desktop.
Shell Script for installing a APK file to all mounted devices.
#!/bin/bash
# Description : You can install APK file to all mounted devices
# Checking Command Line
if [ $# -ne 1 ]
then
echo "Usage : $0 \<APK file name\> "
exit 2
fi
APK_FILE_NAME=$1
# Checking APK file
if ! [ -f $APK_FILE_NAME ];
then
echo "File $FILE does not exists"
exit 2
fi
# Finding Device SERIAL_NO
echo "Installing APK files"
adb devices | grep device | grep -v attached | cut -f 1 > tmpfile
while read SERIAL_NO;
do
adb -s $SERIAL_NO install -r $APK_FILE_NAME
done < tmpfile
rm tmpfile
echo ""
echo "installation Finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment