How to add version code from manifest or gradle to target apk name (Android build)

Good Day!

I want to build Android apk file with name <some_static_text>-<version_code_from_Android_manifest_or_build.gradle>-%build_counter%.apk. How can I tune TeamCity for that?

1 comment
Comment actions Permalink

Hi, first of all you need to extract this <version_code_from_Android_manifest_or_build.gradle> into a TC parameter by using grep, sed or whatever you'd like.

Second, you need to add a new parameter with this value like this:
echo "##teamcity[setParameter name='ddd' value='`cat myFile.txt | grep version`']"

then you will have TC parameter %ddd% containing necessary value. You can now create your artifact by using <some_static_text>-%ddd%-%build_counter%.apk

0

Please sign in to leave a comment.