Batch install multiple apks

January 26, 2015

There are often a situation where I need to install not few but 18 apps in android for testing. Innumerous devices supported by different versionsĀ of android and the bug fixes which translates into more dev and release builds adds more pain to the situation.

As an avid commandline freak, I used the following small script to batch install the apks found in a directory. To use the script, copy all your apks to a dir along with the script and execute it,

I assume adb and aapt in your path already.

for i in `ls $dir`
aapt dump badging $i | perl -ne 'print $2 if /package: name=(.)(.+?)\1/' | xargs -I{} adb uninstall {}
adb install $i

You can replace the contents of the for loop with following if you dont worry about reinstalling apps with existing data.

adb install -r $i