How to Change Version Code and Version Name in Flutter

In this post, we are going to show you how to change the version code and version name of your Flutter app. Version code needs to update while uploading your APK or App bundle to Play Store. Otherwise, you will get the error below:

Play Store Error: You need to use a different version code for your APK or Android App Bundle because you already have one with version code ##.

We will explain the different methods to change the version code and version name of the app in Flutter. We recommend the first one to use.

Open pubspec.yaml file and get the line below:

version: 1.0.0+1

Here, "1.0.0" is the version name and 1 after "+" is the version code. You can update them like below:

version: 1.1.4+2

Note: Version code is an integer, no decimal is allowed on version code. While, you can use decimals on version name.

Open your_project/android/local.properties file and get the code below:

flutter.versionName=1.0.0
flutter.versionCode=1

You can update them like below:

flutter.versionName=1.1.5 
flutter.versionCode=2 //no deciaml, only integer

Open your_project/android/app/build.gradle file and get the lines below:

defaultConfig {
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

Now, update them with your own version code and version name like below:

defaultConfig {
    versionCode 2
    versionName "1.0.5"
}

In this way, you can update the version code and version name of your app in Flutter.

No any Comments on this Article


Please Wait...