In Flutter pubspec.yaml file updated the version to 1.1.0+3 but on uploading to playConsole, still error version code 1

671

Solution 1

Finally resolved it!

The issue was with the android/local.properties file which was not getting updated. I manually updated the version code here and got around the problem.

enter image description here

Solution 2

Did you try to do a flutter clean before building the second time? The previous build might have been cached.

Other then that, check your android/app/build.gradle file there should be something like this there that sets the version:

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
Share:
671
mechbullGT
Author by

mechbullGT

Updated on December 20, 2022

Comments

  • mechbullGT
    mechbullGT over 1 year

    I've tried to upload an updated aab to the playConsole for my application but have got the following error:

    Upload failed 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've tried to update the version code to 3 in the pubspec.yaml but I'm still getting the same version after uploading the latest generated aab/apk.

  • mechbullGT
    mechbullGT almost 4 years
    Thanks for the response, I checked the android/app/build.gradle and everything was as expected.