简体   繁体   English

从android apk文件解析versionCode

[英]Parse versionCode from android apk files

I know .apk files are .zip files, but AndroidManifest.xml looks binary and certainly grep or hex editors haven't been successful extracting the versionCode. 我知道.apk文件是.zip文件,但AndroidManifest.xml看起来是二进制的,当然grep或hex编辑器还没有成功提取versionCode。

Does anybody know how to parse or extract it? 有人知道如何解析或提取它吗? I find myself in a Python script with the apks AndroidManifest.xml file open. 我发现自己在一个Python脚本中打开了apks AndroidManifest.xml文件。

Assuming you have the Android SDK installed, you can use aapt to find this value. 假设您安装了Android SDK,则可以使用aapt来查找此值。 For example, on Linux: 例如,在Linux上:

aapt dump badging MyAwesomeApplication.apk |grep version

they are binary XML files. 它们是二进制XML文件。 You can use a tool like AXML2XML to convert the binary XML file into a text-based XML file. 您可以使用AXML2XML之类的工具将二进制XML文件转换为基于文本的XML文件。 There a few different tools, some do better jobs than others. 有一些不同的工具,有些工作比其他工作更好。

AXML2XML: http://devtcg.blogspot.com/2008/03/tool-to-read-android-binary-xml-files.html AXML2XML: http ://devtcg.blogspot.com/2008/03/tool-to-read-android-binary-xml-files.html

AXMLPrtiner: http://forum.xda-developers.com/showthread.php?t=514412 AXMLPrtiner: http//forum.xda-developers.com/showthread.php? t = 5141412

Use android-apktool : 使用android-apktool

apktool.bat d application.apk apktool.bat d application.apk

You may refer to this . 你可以参考这个 It reads necessary strings from the resource table while translating the binary xml file. 它在翻译二进制xml文件时从资源表中读取必要的字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM