1

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?

Azhan Khan
  • 143
  • 3
  • 14

2 Answers2

4

Instead of changing Gradle files, you need to make the changes in pubspec.yaml file.

It is located in the root directory of your project.

version: 1.0.0+1

A version number is three numbers separated by dots, like 1.2.43

followed by an optional build number separated by a +.

Google Play should accept your APK generated with increased build number.

George Zvonov
  • 9,401
  • 5
  • 33
  • 37
4

This is briefly mentioned in the official documentation for releasing your app.

For Android and iOS, you need to update the "version" value in the pubspec.yaml file.

version: 1.0.0+1

For Android, the first piece ("1.0.0") corresponds to the version name whereas the piece after the + corresponds to version number.

For iOS, the first piece represents the CFBundleShortVersionString and the piece after the + represents the CFBundleVersion.

This answer has more information.

Code on the Rocks
  • 11,488
  • 3
  • 53
  • 61