Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

like image 312
Sheehan Alam Avatar asked Dec 29 '11 18:12

Sheehan Alam


1 Answers

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 .

#!/bin/bash
# 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 com.example.android.apis

adb devices | while read line
do
    if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
    then
        device=`echo $line | awk '{print $1}'`
        echo "$device $@ ..."
        adb -s $device $@
    fi
done
like image 137
Rick Avatar answered Sep 19 '22 03:09

Rick