Parse versionCode from android apk files

IO- picture IO- · Jan 23, 2011 · Viewed 8.2k times · Source

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.

Answer

user1402012 picture user1402012 · May 17, 2012

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