Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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

like image 293
IO- Avatar asked Jan 23 '11 21:01

IO-


3 Answers

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
like image 157
user1402012 Avatar answered Nov 05 '22 13:11

user1402012


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

like image 32
Jason LeBrun Avatar answered Nov 05 '22 13:11

Jason LeBrun


Use android-apktool:

apktool.bat d application.apk

like image 2
Juuso Ohtonen Avatar answered Nov 05 '22 13:11

Juuso Ohtonen