Is there a way to change version code in flutter

Is there a way to change version code in flutter?
I’m setting up the app to upload on play store but the play console gives error-You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1. I tried changing the version code in android>app>build.gradle and even in local.properties but after hot reload or run command the local.properties automatically changes back to flutter.versionName=1.0.0 and flutter.versionCode=1. It may be because of error in my build.gradle file as it shows red mark and give can’t resolve symbol for properties,rootProperties,getProperty etc. and the same error with flutter.buildMode=release in local.properties How can I solve this issue?

@pkrawat1 Please go to your pubspec.yaml file. The first three lines should be name, description, version

For you the version might look something like this:

version: 1.0.0+1

Everything after ‘+’ is your version code. So before creating an apk for release make sure you increment this number by 1.

The following defines the version and build number for your application.

A version number is three numbers separated by dots, like 1.2.43 followed by an optional build number separated by a +. Both the version and the builder number may be overridden in flutter build by specifying --build-name and --build-number, respectively.

In Android, build-name is used as versionName while build-number used as versionCode.
For example, for your next release, it should look something like this:

version: 1.0.1+2

Follow App version convention to set the version number.

1 Like