Skip to content

Instantly share code, notes, and snippets.

@falkorichter
Created October 2, 2012 10:52
Show Gist options
  • Save falkorichter/3818144 to your computer and use it in GitHub Desktop.
Save falkorichter/3818144 to your computer and use it in GitHub Desktop.
A script that can do installs and deinstalls on all connected Android devices
import os
import sys
argument = sys.argv[1]
install = False
if argument.endswith(".apk"):
install = True
revision = os.popen("adb devices").read()
devices = revision.split("\n")
for device in devices:
if device.endswith("device"):
deviceId = device.split("\t")[0]
print "\"" + deviceId + "\""
if install:
print os.popen("adb -s " + deviceId + " install -r " + argument).read()
else:
print os.popen("adb -s " + deviceId + " uninstall " + argument).read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment