Skip to content
Obtain basic information out of an Android APK file.
Branch: master
Clone or download
joakime Update
Adding circleci build badge
Latest commit fe7be2f Feb 18, 2016

Android APK Parsing Lib

Circle CI

Simple class to read/parse the packageName, versionName, versionCode information, and more out of a compiled Android APK file.

This is accomplished by decompressing the AndroidManifest.xml file and then decoding the compiled XML binary file to glean this information.

I've been using this for some automatic versioning of various android artifacts I have. I am sharing this codebase under the Apache Source License 2.0 in hopes that others will find it useful (or educational).


A SNAPSHOT of the library has been deployed to under the following dependency.


Once you have that dependency (no other transitive dependencies required) you can use the following code to get the information you need.



public class ApkDump {
    public static void main(String[] args) {
        if(args.length < 1) {
            System.err.println("Usage: ApkDump [apkfile]");
        File apkfile = new File(args[0]);
        if(!apkfile.exists()) {
            System.err.println("Error: File Not Found: " + apkfile);
        try {
            AndroidApk apk = new AndroidApk(apkfile);
            System.out.println("APK: " + apkfile);
            System.out.println("  .packageName    = " + apk.getPackageName());
            System.out.println("  .appVersion     = " + apk.getAppVersion());
            System.out.println("  .appVersionCode = " + apk.getAppVersionCode());
        } catch(Throwable t) {

That's it, pretty straightforward, the tricky part was decompiling the binary xml file, and that should be easy enough to extend for the other xml files in an APK file (including resources).

You can’t perform that action at this time.