Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload failed You need to use a different version code for your APK because you already have one with version code 2

Tags:

android

apk

People also ask

How do you fix version code 1 has already been used try another version code?

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.

Can I upload APK to Google Play?

Upload the App's APK File to Google PlayIn your browser, go to the address , click Developer Console and log in with your Android Developer account credentials. Click the Add New Application button to begin adding your app to Google Play. Select the language and the name of your app. Press the Upload APK button.


For people who use Android Studio the problem may be solved by editing versionCode and versionName in build.gradle instead of AndroidManifest.xml.

e.g.

defaultConfig {
    applicationId "com.my.packageId"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 2      <-- change this
    versionName "2.0"  <-- change this
}

android:versionCode="28"

Your previous versionCode was 28. You should increment it by 1 to 29.

android:versionCode="29"

Presumably, your previous app versions were 1 through 28. By releasing with versionCode 3, you are conflicting with a previous version of your app that was already released with this versionCode.


In my case it a simple issue. I have uploaded an app in the console before so I try re-uploading it after resolving some issues. All I do is delete the previous APK from the App Bundle Explorer (formally called Artifact Library)


if you are using ionic framework, go to config.xml file and change the "version" attribute in the "widget" tag. increase the version number. then rebuild, sign and upload ur apk to play store. that fixed my problem.


This error appears when you try to upload an apk that has same version values as the one already on playstore.

Just change the following in your build.gradle file => versionCode and versionName

defaultConfig {
    applicationId "com.my.packageId"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 2      <-- increment this by 1
    versionName "2.0"  <-- this is the version that shows up in playstore, 
                           remember that the versioning scheme goes as follows.
                           first digit = major breaking changes version
                           second digit = minor changes version
                           third digit = minor patches and bug fixes.
                           e.g versionName "2.0.1"
}

(For Flutter App) You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1.

Don't be panic...

You need to change in Flutter Version from pubspec.yaml file and Version Code from local.properties file.

First go to your pubspec.yaml file. The first three lines should be name, description and version of App.

Before Release -

For you the version might look something like this:

version: 1.0.0+1

So before creating an apk for release (for update your exiting app on Google Play Console i.e for new update) make sure you increment this number by 1. (You should increment it as there's no requirement on increment step) .

Solution

Just change that version to (As per your need )

version: 1.0.1+2

And Second if

flutter.versionCode in Project -> android -> local.properties is

flutter.versionCode=1 then change it or upgrade it to the flutter.versionCode=2 or any other greater number than previous code.

And finally release the app as per documentation.