Sheehan Alam Sheehan Alam - 2 years ago 122
Bash Question

How can I use adb to uninstall an APK from multiple connected devices?

adb uninstall <package name>
works when 1 device is connected.

How can I make this work for 5+ devices that are connected?

Answer Source

Here is a simple script I use to execute adb commands over all my devices , should work under Linux and MacOsX .

You might need to adapt it to your development environment .

# Script adb+
# Usage
# You can run any command adb provide on all your current devices
# ./adb+ <command> is the equivalent of ./adb -s <serial number> <command>
# Examples
# ./adb+ version
# ./adb+ install apidemo.apk
# ./adb+ uninstall

adb devices | while read line
    if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
        device=`echo $line | awk '{print $1}'`
        echo "$device $@ ..."
        adb -s $device $@
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download