# Build numbering and app versioning

All Bitrise builds have a build number. The first build of your project is, by default, number 1, and the build number gets incremented with each build. You can get a build’s Bitrise build number on the website, as well as via the `$BITRISE_BUILD_NUMBER` Environment Variable. This variable can be used in any Step or script where you need the Bitrise build number for any reason.

You can change the build number manually on the web UI. For details, see: [Changing the build number on the web UI](/bitrise-ci/run-and-analyze-builds/build-numbering-and-app-versioning#changing-the-build-number-on-the-web-ui).

Bitrise also helps you taking care of your mobile app’s versioning automatically, using Bitrise. We have two Steps to do it for you, one for iOS and one for Android. For details, see: [Setting up app versioning automatically on Bitrise](/bitrise-ci/run-and-analyze-builds/build-numbering-and-app-versioning#setting-up-app-versioning-automatically-on-bitrise).

## Changing the build number on the web UI 

The build number is automatically incremented whenever you run a build, but you can set it manually on the **Project settings** page of your Bitrise project. 

:::note[Negative build numbers]

The build number must be a positive integer. Zero or negative numbers are not accepted. You can, however, set any number you have already used.

:::

1. 1. Open your project on Bitrise with a user that has the **Admin** [role on the project](/bitrise-platform/projects/roles-and-permissions-for-bitrise-ci), or a [custom role](/bitrise-platform/workspaces/collaboration-and-permissions-in-workspaces/custom-roles/custom-roles-overview) with the **Edit workflows** permission.
1. On the main page of the project, click on the **Project settings** button.
1. On the left, select **Builds**.
1. Find **Next build number** and click **Edit**.

   ![Next build number section on the Builds page of Project settings](/img/run-and-analyze-builds/2026-07-13-next-build-number-project-settings.png)
1. Add the desired build number then click **Save**.

## Setting up app versioning automatically on Bitrise

Track the version of your mobile app in its Git repository by modifying the file containing the essential information about the app (for example, the `Info.plist` file for iOS apps and either the `build.gradle` file or the `AndroidManifest.xml` file for Android apps).

Bitrise has two Steps to do this for you. These two Steps can insert the Bitrise build number or some other specified number into their respective files:

- **Change Android versionCode and versionName** for Android apps.
- **Set Xcode Project Build Number** for iOS apps.

Both Steps accept either numbers (integers and/or numeric strings) or environment variables in their relevant inputs. By default, both use the $BITRISE_BUILD_NUMBER Environment Variable as their default value for the build number.

### Setting the versionCode and the versionName of an Android app

For an Android app, the setting is used as an internal version number, to determine if a build of the app is more recent than another build. The `versionName` setting is a string used as the version number shown to users.

For in-depth information about Android versioning, please check out [the Android developer guide on the subject](https://developer.android.com/studio/publish/versioning).

:::note[Version information in the manifest file]

In this guide, we’re setting the version information in the `build.gradle` file. This is the recommended method: you can also set it directly in the `AndroidManifest.xml` file but be aware that any version info set in the manifest file before the build will be overwritten by the `build.gradle` file’s settings during the build.

:::

To configure Android versioning:

1. Add the **[Change Android versionCode and versionName](https://bitrise.io/integrations/steps/change-android-versioncode-and-versionname)** Step to your Workflow.
1. Set the the path to your `build.gradle` file in the **Path to the build.gradle file** input.

   ![change-android-version.png](/img/_paligo/uuid-fb7fb260-5679-1832-9448-228a048e2b80.png)
1. Add a value in the **New versionName** input.
1. Add a value in the **New versionCode** input.

   The default value is the $BITRISE_BUILD_NUMBER Environment Variable.

### Setting the CFBundleVersion and CFBundleShortVersionString of an iOS app

For an iOS app, the value of the `CFBundleVersion` key (“Bundle version” in Xcode) is the build number of the app while the value of the `CFBundleShortVersionString` key (“Bundle versions string, short” in Xcode) is the version number of the app.

For in-depth information about iOS versioning, including the functions of the `CFBundleVersion` and the `CFBundleShortVersionString` keys, please check out [this Apple technical note](https://developer.apple.com/library/archive/technotes/tn2420/_index.html); you can also look up the [summary of most important keys](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html).

:::important[Setting up iOS versioning for apps using Xcode 13+]

To set up iOS versioning on Bitrise using Xcode 13+, update the following in Xcode:

- Set the **Generate Info.plist File** to `No`, under **PROJECT** and **TARGETS** on the **Build Settings** tab.
- Make sure you have all the necessary keys defined in the `Info.plist` file.

:::

1. Add the **Set Xcode Project Build Number** Step to your Workflow.
1. Check the **Project path** and **Scheme** inputs. They default to `$BITRISE_PROJECT_PATH` and `$BITRISE_SCHEME`, so you usually don't need to change them. Optionally, set **Target** or **Configuration** to limit the change to one target or build configuration.
1. Add a value in the **Build Number** input. This sets the `CFBundleVersion` key to the specified value in the `Info.plist` file. The default value is the $BITRISE_BUILD_NUMBER Environment Value.
1. Optionally, add a value in the **Version Number** input. This will set the `CFBundleShortVersionString` key to the specified value in the `Info.plist` file. This input is not required.

## Offsetting the build version

You can offset your app’s build version numbers if you tracked versions differently before using Bitrise. For example, if your app already had six builds before you started using Bitrise, you can offset the version code so it continues from where you left off, instead of restarting from 1.

**Android**

1. Add the **Change Android versionCode and versionName** Step to your Workflow.
1. In the **New versionCode** input, use `$BITRISE_BUILD_NUMBER` (this is the input's default value).
1. In the **versionCode Offset** input, set the value to add to the build number. This can be a fixed integer or an Environment Variable.

:::tip[Offsetting an Android app's version example]

Let’s say you're about to run your app's fifth build on Bitrise, and the app already had six builds before you started using Bitrise. To keep versionCode numbering continuous:

- New versionCode: `$BITRISE_BUILD_NUMBER`
- versionCode Offset: `6`
- New versionName: `1.0.5`

`$BITRISE_BUILD_NUMBER` (5, in this example) is added to the versionCode Offset (6), so versionCode is set to 11. versionName isn't affected by the offset and stays 1.0.5 — so this build is versionName 1.0.5, versionCode 11 (the 11th build of version 1.0.5).

:::

**iOS**

1. Add the **Set Xcode Project Build Number** Step to your Workflow.
1. In the **Build Number** input, use `$BITRISE_BUILD_NUMBER` (this is the input's default value).
1. In the **Build Number Offset** input, set the value to add to the build number. This can be a fixed integer or an Environment Variable.

:::tip[Offsetting an iOS app's version example]

Let’s say you're about to run your app's fifth build on Bitrise, and the app already had six builds before you started using Bitrise. To keep the build number continuous:

- Build Number: `$BITRISE_BUILD_NUMBER`
- Build Number Offset: `6`
- Version Number: `1.1`

`$BITRISE_BUILD_NUMBER` (5, in this example) is added to the Build Number Offset (6), so CFBundleVersion is set to 11. CFBundleShortVersionString isn't affected by the offset and stays 1.1 — so this build is version 1.1, build 11.

:::
