借助aapt.exe文件
aapt.exe 解析apk包信息cmd命令:
aapt dump badging *.apk
aapt d badging *.apk >1.txt(保存成1.txt文件)
ProcessStartInfo start = new ProcessStartInfo("cmd.exe");
start.CreateNoWindow = true;
start.RedirectStandardInput = true;
start.RedirectStandardOutput = true;
start.UseShellExecute = false;
Process process = Process.Start(start);
try
{
var aaptFile = Server.MapPath("~/aaptFile/aapt.exe");
//apkPath 安装包路径
process.StandardInput.WriteLine(aaptFile + " d badging \"" + apkPath + "\"");
StreamReader reader = process.StandardOutput;
while (!reader.EndOfStream)
{
//解析所需要数据
string output = reader.ReadLine();
}
}
catch
{}