Skip to content

Flutter App Versioning Guide

Updating Version in pubspec.yaml

Update the version: A.B.C+X in your pubspec.yaml file.

Version Format Explanation

For Android:

  • A.B.C represents the versionName (e.g., 1.0.0)
  • X (the number after the +) represents the versionCode (e.g., 1, 2, 3, etc.)

For iOS:

  • A.B.C represents the CFBundleShortVersionString (e.g., 1.0.0)
  • X (the number after the +) represents the CFBundleVersion (e.g., 1, 2, 3, etc.)

Example pubspec.yaml

yaml
name: your_app
description: Your app description
version: 1.2.0+3

Important Build Steps

For Android

Do not forget to execute one of the following commands after updating the version:

bash
flutter build apk

or

bash
flutter run

Why this is important: When you run flutter build apk or flutter run after updating the version in the pubspec file, the versionName and versionCode in local.properties are updated. These values are later picked up in the build.gradle (app) when you build your Flutter project, which is ultimately responsible for setting the versionName and versionCode for the APK.

For iOS

Do not forget to execute one of the following commands after updating the version:

bash
flutter build ipa

or

bash
flutter run

Manual Configuration (Android)

In build.gradle (Module: app)

gradle
android {
    ...
    defaultConfig {
        ...
        versionCode 2        // для Google Play
        versionName "1.1"    // для пользователей
    }
}

In Android Manifest

xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="......"
    android:versionCode="26"
    android:versionName="3.1.6">

Version Number Guidelines

Version Name (A.B.C)

  • A - Major version (breaking changes)
  • B - Minor version (new features)
  • C - Patch version (bug fixes)

Version Code (X)

  • Should be incremented with each release
  • Used by app stores to determine if an update is available
  • Must always increase for new releases

Best Practices

  1. Always increment version code for each release to app stores
  2. Follow semantic versioning for version names
  3. Test thoroughly after version updates
  4. Keep version numbers consistent across platforms
  5. Document version changes in your release notes

Common Version Examples

Release TypeVersion NameVersion CodeFull Version
Initial Release1.0.011.0.0+1
Bug Fix1.0.121.0.1+2
New Feature1.1.031.1.0+3
Major Update2.0.042.0.0+4

Remember: The version code must always increase, even if you're releasing a lower version name for any reason.