Created
June 13, 2016 13:45
-
-
Save guysmoilov/e6b39dc9dfad9e1123fb75ef7f284bc2 to your computer and use it in GitHub Desktop.
Python script to reinstall an apk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
import re | |
apkpath = sys.argv[1] | |
print('checking packagename') | |
head = subprocess.check_output('aapt d badging "' + apkpath + '"').decode("utf-8").split("\n")[0] | |
packagename = re.match(r'^package: name=\'([A-Za-z0-9\.]+)\'', head).group(1) | |
print('uninstalling ' + packagename) | |
subprocess.check_call("adb uninstall " + packagename) | |
print('installing ' + apkpath) | |
subprocess.check_call('adb install "' + apkpath + '"') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment