Updates the Android versionCode and versionName in your project's build.gradle file.
Description
Modifies the version information of your Android app by updating versionCode and versionName attributes in your project's build.gradle file before you'd publish your app to Google Play Store.
- Insert the Change Android versionCode and versionName Step before a build Step such as Android Build or Gradle Runner in your Workflow.
- Click the Step to modify its input fields.
- Add the file path to the Path to the build.gradle file so that the Step knows where to find the file that contains the versionCode and versionName attributes.
- Provide a new versionName in the New versionName input. If you leave this input empty, the previous versionName will be displayed on Google Play Store. The input's value must be a string in this format
<major>.<minor>.<point>. - Provide a versionCode in the New versionCode input to track app versions. If you leave this input empty, you will release your app with the version that is already set in the
build.gradlefile'sversionCodeattribute. The input's value must be an integer. If you wish to offset the value you set in the New versionCode input, then you can use the versionCode Offset input to add the offset integer value here. This number will be added to the versionCode's value.
The Change Android versionCode and versionName Step must be inserted BEFORE the Android Build Step as the former makes sure you upload the build with the right versionCode and versionName to Google Play Store.
Add this step directly to your workflow in the Bitrise Workflow Editor.
You can also run this step directly with Bitrise CLI.
Inputs
| Key | Description | Flags | Default |
|---|---|---|---|
build_gradle_path |
Path to the build.gradle file shows the versionCode and versionName settings. | required | $BITRISE_SOURCE_DIR/app/build.gradle |
new_version_name |
New versionName to set. Specify a string value, such as "1.0.0". If the specified value is not surranded by double quote (") characters, the step will add them. Leave this input empty so that versionName remains unchanged. |
||
new_version_code |
New versionCode to set. Specify a positive integer value, such as 1. The greatest value Google Play allows for versionCode is 2100000000. Clear this input's default value to leave the versionCode unchanged. |
$BITRISE_BUILD_NUMBER |
|
version_code_offset |
Offset value to add to New versionCode, for example: 1. Leave this input empty if you want the exact value you set in New versionCode input. |
Outputs
| Environment Variable | Description |
|---|---|
ANDROID_VERSION_NAME |
The final Android versionName set in the build.gradle file after the Step execution. |
ANDROID_VERSION_CODE |
The final Android versionCode set in the build.gradle file after the Step execution. |
We welcome pull requests and issues against this repository.
For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.
Learn more about developing steps: