Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version code 1 has already been used. Try another version code

I am uploading new app bundle to play console and it is saying after uploading Version code 1 has already been used. Try another version code.

I have changed version number in pubspec.yaml from version number: 1.0.0+1 to 2.0.0+1 even though it is saying the same error

like image 812
balu k Avatar asked Jun 20 '21 16:06

balu k


People also ask

How do I get the version code in flutter?

To update the app version in Flutter, you can simply open the pubspec. yaml file and then update the version tag. Inside the version tag, just increase the build number (for Android) or CFBundleVersion (for iOS).


4 Answers

You have two ways to solve this, if you released your bundle already, then you have to update your version code like in Len_X's answer,

If you're still developing and pushed app bundle for say, testing, and then you delete it, this bundle is saved as a draft with that version code. Therefore, it says that you can't use the same version because it already sees another one with the same version name.

Here's how you fix it:

  1. Go to the release section
  2. go to app bundle explorer, in the top right you should see a dropdown button for you app version, click on it.
  3. A bottomsheet will show containing all the previous app bundles you uploaded it. Delete the one with clashing bundle version and you're good to go.

Hope that solves your problem.

like image 169
Michael Soliman Avatar answered Oct 16 '22 17:10

Michael Soliman


You can do it manually by going to "app_name/android/app/build.gradle" file. In defaultConfig section change version code to a higher number

  defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1 // Change to a higher number
        versionName "1.0.1" // Change to a higher number
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
like image 57
Titas Černiauskas Avatar answered Oct 16 '22 17:10

Titas Černiauskas


First go to the app/build.gradle

enter image description here

change versionCode and versionName like this (+1)

enter image description here

I think this will be helpful for someone ✌😊

like image 31
hexhad Avatar answered Oct 16 '22 16:10

hexhad


For Flutter only: Goto Pubspec.yaml file and find version key and Change the value after the + sign.

For Example: In your pubspec.yaml file, if your version is like this version: 1.0.0+1 then change it to version: 1.0.0+2

like image 18
balu k Avatar answered Oct 16 '22 17:10

balu k