Android Build Number and Version

Hi, I need to get Android application version and build number. For the iOS I was able to use Xcode Project Information Build Step, which expose XPI_BUILD and XPI_VERSION env. variables that I could implement in rb script, how can I do same thing with Android? I searched for some similar step but I wasn’t able to find out anything similar for the Android OS. Thanks for you support

2 Likes

Great question @MOLO17!

You should search for manifest in the step lists (http://www.bitrise.io/integrations), there are a couple of Android manifest related steps (four right now), which can help with setting and getting values to/from the manifest file.

Let us know if you have any questions!

1 Like

I recently made an equivalent to the “Xcode Project Info” step but for android called “Android Manifest Info”. It exposes AMI_VERSION_CODE and AMI_VERSION_NAME amoung others. Search for it on bitrise. Source code on github https://github.com/tomcurran/bitrise-step-android-manifest-info

2 Likes

Awesome, thank you for the info (and for the step) @tomcurran! :wink:

Thanks for all your right answers.
Only one thing… currently I’m not able to use that step because I don’t understand which form of path I’ve to use for the manifest file.

For example… If I would like to have the file under ./app/Manifest.xml, which path should I put in the environment variable which you specify as default for your step?

Currently I couldn’t find a valid form… file:// or ./ doesn’t work.

1 Like

Which step did you try @MOLO17?

The ./relative/path should definitely work, but make sure the path is relative to the repository root, unless you change the working directory during the build (not common, but you can do this with e.g. the Change Working Directory step, in that case the path should be relative to the “current working directory” - the one you changed to).

@here

I tried mentioning the path and it throwed me an error no file exists under that path. Can you please give me an example how to fetch the exact path to be set