Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adb command to get versionCode from apk [duplicate]

Is there an adb command to run on a .apk which gives me the android:versionCode that is set in the AndroidManifest file of that apk?

Basically, how do I get the version code of the apk using adb?

like image 408
TheWaterProgrammer Avatar asked Jan 31 '19 18:01

TheWaterProgrammer


People also ask

How can I get IMEI number from ADB?

adb shell dumpsys iphonesybinfo You can check and save the IMEI number of your device by dialing *#06# in your dialer app and taking a screenshot of it.


1 Answers

For Version Name :

adb shell dumpsys package my.package | grep versionName

For Version Code :

adb shell dumpsys package my.package | grep versionCode

Also you can try this below too:

Android: Get versionName or versionCode of an APK from the command line You can use aapt in android's build-tools directory of whatever build tools version you're using.

You pass that tool the badging command, and then pass it the location of your APK.

Example:

$ANDROID_HOME/build-tools/24.0.2/aapt dump badging app/build/outputs/apk/app-release.apk

If you scroll through all the output, you can find the versionName and versionCode.

like image 66
Gaurav Bansal Avatar answered Sep 18 '22 06:09

Gaurav Bansal