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:
Go to the 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.
If you're running into app bundle approval issues inside of the Google Play store with an Expo/React Native project, here are some tips:
Google Play versioning is actually checking your AndroidManifest.xml file for versioning (/android/app/src/). This should get updated from Expo's app.json file (/app.json) during build, per their instructions.
app.json example section, where I've bumped my app up to a v2.0 - note the versionCode inside of the Android settings object AND the version at the settings object root both need to be adjusted:
If your Android version isn't updating (possibly if you have a detached Expo app), you have to go directly into the AndroidManifest.xml file and make the modification there (/android/app/src/):
Example of AndroidManifest.xml (note your modifications happen on the <manifest> tag, using the android:versionCode and android:versionName:
If you're still having issues, remember that Android versionCode and versionName are two different things. Android does not seem to recognize semver standards. versionCode increments as whole numbers (ie, if you went from semver v1.0.0 to v1.1.0 that is versionCode 1 to 2.
if you remove apk then upload same version apk so you get Error Version code 1 has already been used. Try another version code in this situation you should remove version from App bundle explorer then upload same version apk.
with my flutter project building a release for android i faced the same issue. all was doing is change version code in Pubspec.yaml but did not seem to change my android version...
so i went to Android folder and added version code manually in local.properties file :
/project/android/local.properties
I always used to increment version code in my android/app/build.gradle file, and it always used to work. Then, after a recent update in Android Studio, it suddenly didn't anymore, and I got this error!
I never cared to dig into the build.gradle code, but now, I did. Here, at the "TODO", is where I used to change the version code number:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '19' // TODO: ---Count up with each release
}
But that only works if the version code from the local.properties file comes back as "null"!... I just realized. So probably, all this time, my compiler never managed to get values from local properties, but now all of a sudden, it does!
So I found the android/local.properties file and tried changing the version code there:
sdk.dir=C:\\Users\\karol\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\src\\flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1 //Change this to 19 (my current version code number)
But that didn't work, because the moment I ran flutter build appbundle, this file changed itself back to the original values...
I then tried adding version code values to my AndroidManifest.xml file, according to serraosays' answer, but that didn't help me either.
Functioning work-around
In the end, I did this in the android/app/build.gradle file:
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
//if (flutterVersionCode == null) {
flutterVersionCode = '19' // TODO: ---Count up with each release
//}
That is, I commented out the condition. Now, my setting would over-write any value retrieved from the local.properties file.
If anyone can tell me the proper way to increment the version code number, I'm all ears! 🙂 But in the meantime, this worked for me, and hopefully for someone else as well.
First, is common given in other answers: you must increase the version number to send an update to Play Console. Eg. previous app version: 1.0.5+5 and next update must contain 1.1.2+6. The +6 must be next to the previous update present on your play console.
Second reason for this error is you have skipped some numbers in between. Eg. Previous released version: 1.0.5+5 but the new version you are trying to release is 1.0.6+8. The +8 is not allowed directly, you must put +6 then +7 and then next numbers.
In unreal engine you can change this in project settings. Steps are as follows.
(Me I'm using UE4.27.2)
Step 1:
Open Project Settings
Step 2: Click all settings and in the top search bar type in "version" Without Quotes.
Step 3:
Scroll down to >Platforms>Android>apk packaging
Step 4:
Change the store Version for each +1 what you already have
APK PAckaging
(You do not need to change version display name but you can if you want to this can be edited later on in google console)