说明
本文以具体的python脚本为例进行说明,两个脚本都是根据开发过程中的业务需求而开发,并不具备通用性。但是其核心代码都是通过python的api执行adb命令:
//example
cmd = 'adb shell'
os.system(cmd)
uninstall_clean_app.py
#!/usr/bin/python
import subprocess
import os, sys
import getopt
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
if __name__ == '__main__':
""" change commands and add shell"""
tag = ''
try:
opt, args = getopt.getopt(sys.argv[1:], "ht:", ['pkg', 'help'])
for op, value in opt:
if op in ("-t", "--pkg"):
tag = value
if op in ("-h", "--help"):
print "Usage: main_app_clean.py -t APP_PKG_NAME"
print "Options:"
print " -t APP_PKG_NAME should