Skip to content

Instantly share code, notes, and snippets.

@Shujito
Last active March 7, 2019 01:47
Show Gist options
  • Save Shujito/94964b3b296cffa8676ee694237c7b2a to your computer and use it in GitHub Desktop.
Save Shujito/94964b3b296cffa8676ee694237c7b2a to your computer and use it in GitHub Desktop.
uninstall android app from all connected devices and emulators
#/bin/sh
for DEVICE in $(adb devices | grep device$ | awk '{print $1}');
do
for APP in $(find . -maxdepth 3 -type f | grep build\.gradle | xargs cat | grep applicationId | awk '{print $2}');
do
RESULT=$(echo $APP | xargs -I _ adb -s $DEVICE uninstall _ 2>/dev/null);
if [ "$RESULT" == "Success" ]; then
echo "Uninstalled $APP from $DEVICE"
fi
done;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment