个人感觉错误原因是:执行 subprocess.Popen 就没有成功一样;求大佬指点

代码如下:
import subprocess
apkpath = "E:/apium_phone/apk/YYHL_Android_V1_2_2_ver_r0601.apk"
aapt_path="D:/android-sdk/build-tools/28.0.2"
def get_apk_pkg():
# cmd = "aapt dump badging " + apkpath + " | grep package:"
cmd= "aapt dump badging " + apkpath + '| find "package"'
result = ""
print(cmd)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE, shell=True)
# print(p)
print(p.communicate())
(output, err) = p.communicate()
if output != "":
result = output.split()[1].decode()[6:-1]
return result
print(get_apk_pkg())

返回结果:


↙↙↙阅读原文可查看相关链接,并与作者交流