2

I'm trying to deploy our Nativescript app to the Google Play Store using a YML pipeline in Azure DevOps. There is a deployment task that automatically increases the versionCode and versionNumber, which always used to work fine.

However now that we upload, I get this error:

##[error]Error: Failed to upload the bundle /Users/runner/work/1/_Android/app-release.aab. Failed with message: Error: APK specifies a version code that has already been used..

I see that the latest version in Google Play store is 1.0.3601

VersionCode in Google Play store

In the release pipeline I see that the versionCode generated is 1.0.3603 and versionName is 1.0.3604

VersionCode in Azure DevOps release pipeline

How can this be solved? What am I doing wrong?

Erwin1441
  • 263
  • 1
  • 5
  • 19

1 Answers1

3

As suggested by User Kingston Fortune - Stack Overflow, make sure to change versionCode and versionName in build.gradle file:

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"
}

References: Upload failed You need to use a different version code for your APK because you already have one with version code 2 , Problem with build version when publishing APK to Play Store , https://github.com/bitrise-steplib/steps-google-play-deploy/issues/31 and https://developer.android.com/studio/publish/versioning#appversioning

Madhuraj Vadde
  • 1,099
  • 1
  • 5
  • 13
  • 1
    The store actually doesn't care about the versionName- you can call as many builds "2.0.1" as you want. It cares that the code is always a new one, and always increasing. – Gabe Sechan Mar 17 '22 at 06:29
  • Hey @Erwin1441, do let me know if the provided information solved your problem else share more details so I can troubleshoot share you more details. – Madhuraj Vadde Apr 12 '22 at 07:25