APK version
Android development
APK tools
Android tips
VersionCode extraction

Get an APK's versionName or versionCode without installing it

Codemia Knowledge Hub ·

You can read an APK's versionName and versionCode without installing it, because both are stored in the APK's AndroidManifest.xml. The usual tool is AAPT (Android Asset Packaging Tool) from the Android SDK, which reads that metadata straight from the .apk file.

versionName vs versionCode

An .apk (Android Package) file contains the app's code, resources and metadata, including two version attributes defined in AndroidManifest.xml:

  • versionName: a human-readable string (for example 1.0.0) that usually follows the major.minor.patch convention.
  • versionCode: an integer for the version of the app code. It only increases, so newer versions get higher numbers, which tools like the Google Play Store use to decide update eligibility.

Knowing these lets developers and users track updates, maintain compatibility and manage dependencies.

Reading the version with AAPT

AAPT is part of the Android SDK and is designed to handle the contents of .apk files, including extracting versionName and versionCode.

  1. Install the Android SDK Build Tools, which include aapt, through the SDK Manager or by downloading the tools directly.
  2. Locate the APK file you want to inspect.
  3. Run aapt against the APK to extract the version details. It lives in android_sdk/build-tools/<version>/:
bash
aapt dump badging path/to/app.apk | grep package

The first line of the output carries both values:

text
package: name='com.example.app' versionCode='42' versionName='1.4.2' ...

aapt2 dump badging path/to/app.apk works the same way with the newer AAPT2.

Online APK analyzers

Some online services display an APK's metadata, including version codes, after you upload the .apk file.

Security and automation

  • Security: make sure you have the right to analyze the .apk, especially with online services, since uploading can expose the file to risks.
  • Automation: these techniques can run in CI/CD pipelines to extract and validate version information before deployment.
  • Parsing output: script around the command-line output for automated or batch workflows.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms