Get version of an apk package version using code

I was just curious to see if we can get the apk version.

Is there way to get the version of apk package using code?


Sorry for using your topic, but my question is similar :smile:

Is there a way to find out the android API of the phone we are using? Because API 17 for example fails on simple things such as text(“my_text”), button(“button_name”), etc. So I’m thinking of having different code for some methods.


Hmmm. You could try using the pullFile command to download and open the AndroidManifest file for the app…

@Telmo_Cardoso I think you should keep track within your own test framework.


It would be of great help if you can help me with usage of pullfile. Where can I find AndroidManifest.xml in device/emulator for a particular app. Or is there a way to get the AndroidManifest.xml using apk.


Below command should work

aapt l -a name.apk