Version code 1 has already been used. Try another version code
Solution 1
you have two ways doing 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, so it says that you can't use the same version because it already sees another one with the same version name. you can fix that by going to release section, go to app bundle explorer, in the top right you should see a dropdown button for you app version, click on it, 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's your problem
Solution 2
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()]
}
}
}
Solution 3
First go to the app/build.gradle
change versionCode
and versionName
like this (+1)
I think this will be helpful for someone ✌😊
Solution 4
You have to increment the +1
, it should be +2
to indicate build number
Solution 5
Goto Pubspec.yaml
file and find version
key and Change the value after the + sign.
Example:
in your pubspec.yaml file your version is like this version: 1.0.0+1
then change it to version: 1.0.0+2
balu k
Updated on December 08, 2021Comments
-
balu k over 2 years
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
-
Len_X almost 3 yearsThis is not a maintainable solution.
-
Michael Soliman almost 3 years@Len_X this solution is only for pre-releasing, if you release your app, then your solution is the right way
-
ce-loco almost 3 yearsThanks for the 2nd option (app bundle explorer). I had created a release and it was denying my upload. Didn't want to increment +1 to keep iOS version paired.
-
mgalgs over 2 yearsShouldn't the build number be "scoped" from within the version number?
1.0.0+1
and2.0.0+1
are obviously not the same version... -
Ryosuke Hujisawa over 2 yearsand you need
% flutter build appbundle --release
again -
serraosays over 2 yearsSuper confusing to keep track of.
-
Brandon Essler over 2 years@OshMansor, by OP do you mean Len_X or balu k? Changing the version from
1.0.0+1
to1.0.0+2
or2.0.0+1
should avoid the issue. Or are we saying that's not the case? If you increment the major version number, do you also need to increment the revision number? That is,1.0.0+1
to2.0.0+1
won't solve this issue, but1.0.0+1
to2.0.0+2
will? -
Osh Mansor over 2 years@BrandonEssler OP=Len_X. And yes only your latter case would work i.e.
1.0.0+1
to2.0.0+2
. I tried the former and it still would not let me pass the submission. -
Jay N over 2 yearsI can't see the "delete" option when I click on the dropdown, next to app version. Does it still work?
-
gildniy over 2 yearsThis is what I was looking for as I had to update the bundle before publishing it.
-
Aditya Peshave over 2 yearsIt's so confusing to delete the existing aab, I just couldn't and now the worst has happened, my apple version is 1.0.1 whereas my android is on 3.0.0(3)....
-
charles young about 2 yearsThis is the simplest way if you are not ready to increment the version number in your bundle. It worked for me!
-
Karolina Hagegård almost 2 yearsWeird that this works for you!... This has never worked for me. Also "version" and "version code" are not the same thing so... your SDK automatically increments your version code when you change your version name? 🤔
-
Karolina Hagegård almost 2 yearsHowever, there is a point with version code numbers! 🙂 If you do it this way, you're missing that point.
-
Karolina Hagegård almost 2 yearsHowever, this is just "default configurations"... Doesn't all the other code in the
android/app/build.gradle
file sometimes over-write the default values? Or this over-writes the other code?... In any case, feels like there is some proper way to do it, that we haven't yet figured out. 😏 -
Karolina Hagegård almost 2 yearsEven when you pre-release, you can increment the version code number! It's not the same as the version name, after all. I just published my blackbox version 1.0.0 with the version code 18. 🙂 The user sees only "1.0.0". The "18" is only for Play Store.
-
balu k almost 2 yearsThe number after the "+" sign is version code
-
Karolina Hagegård almost 2 yearsNo, it isn't!... You don't even have to put a number after the plus sign of you don't want to! You can just put "1.0.1" for example.
-
Alexa289 almost 2 years@MichaelSoliman how to delete the app bundle in the bottomsheet? (step 3) , I can't find delete button/icon on the bottom sheet like this: i.stack.imgur.com/oFK0L.png
-
Edward Falk almost 2 yearsFor what it's worth, I have the versionCode set to
40000
and version Name set to"4.0"
in my build.gradle, and the app bundle still gets 1/"1.0" -
midnite almost 2 yearsFYI I was testing around and uploaded four app bundles for closed testing. Not sure why only the release 4 and 2 can be deleted. The "Delete app bundle" button does not show up for release 1 and 3.
-
Mahmoud Mousa Hamad almost 2 yearsThe bundle I was trying to delete was used in a draft release and I couldn't find the delete bundle button. After I deleted the release, the delete bundle button appeared. :)