Parse versionCode from android apk files

2019-03-17 17:41发布

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.

Does anybody know how to parse or extract it? I find myself in a Python script with the apks AndroidManifest.xml file open.

4条回答
别忘想泡老子
2楼-- · 2019-03-17 18:23

they are binary XML files. You can use a tool like AXML2XML to convert the binary XML file into a text-based XML file. 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

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

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-17 18:23

You may refer to this. It reads necessary strings from the resource table while translating the binary xml file.

查看更多
何必那么认真
4楼-- · 2019-03-17 18:25

Use android-apktool:

apktool.bat d application.apk

查看更多
成全新的幸福
5楼-- · 2019-03-17 18:28

Assuming you have the Android SDK installed, you can use aapt to find this value. For example, on Linux:

aapt dump badging MyAwesomeApplication.apk |grep version
查看更多
登录 后发表回答