Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find versionnumber and versioncode of apk generated by android studio

I know that .apk files are zip files and when we extract them can parse manifest file inorder to finding some information about the app. It is very useful for someone like me that is going to create an app-store. Actually at least I can find the version name and version code of the app.

But in the android-studio when we build a signed apk the version name and version code is not defining in the manifest file. We should define them in the build.gradle file. So now in my app-store when users upload the files how can I find the version code and version name and detect that is not same with old versions?

like image 682
Husein Behboudi Rad Avatar asked Jul 27 '14 05:07

Husein Behboudi Rad


People also ask

What is Versioncode and Versionname in Android?

The version code is an incremental integer value that represents the version of the application code. The version name is a string value that represents the “friendly” version name displayed to the users.

How do I find the version of an app?

Once in Settings, tap Apps and notifications (or your phone manufacturer's name it). When you're in there, tap See all xyz apps (where xyz is the number of apps you have installed). Now scroll down until you find the app you want to find the version for. Then tap it in the list.


1 Answers

Just use AAPT from your path/to/your/android-sdk/build-tools/your-api-version-available/...

An example of the command execution:

aapt dump badging theuserapp.apk

And it will respond with something like:

package: name='com.blabla.theuserapp' versionCode='2000' versionName='2.0.0'

Of course, as the tool is an executable which produces a raw text output you can easily script it and parse from your favorite scripting languaje.

like image 165
Martin Revert Avatar answered Sep 18 '22 08:09

Martin Revert