How to upload an app to the Play Store for the second time? you already have one with version code 1 error

617 views Asked by At

I was sucessfully uploading my apk to the play store in branch internal testing and suddently, it started to refuse my new apk with this error:

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

enter image description here

This is my app.json used by expo for generating the manifest:

{
    "android": {
      "package": "com.myapp.www",
      "versionCode": 360010305,
      "permissions": [
        "CAMERA_ROLL",
        "CAMERA",
        "LOCATION",
        "NOTIFICATIONS",
        "WRITE_EXTERNAL_STORAGE",
        "READ_EXTERNAL_STORAGE"
      ]
    }
}

I use this since I have installed semantic-release-expo which take care of updating the app.json for me upon each new release.

Since the default is already code, I wonder why I still got this error, perhaps I should change this setting to increment and set the versionCode to 1 ?

Why I am not allowed anymore to publish the builded apk (on expo's CIs) to the PlayStore anymore ?

4

There are 4 answers

0
Dimitri Kopriwa On BEST ANSWER

The problem did arrive with expo SDK36, removign the sdkVersion from package.json and causing expo-semantic-release to not update the versionNumber of the android application.

This was fixed by adding in my expo configuration app.json:

{
  "expo": {
+    "sdkVersion": "38.0.0"
  }
}
0
luke cross On

Update your Build.gradle to:

...
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.example.yourpackage"
        minSdkVersion 21
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 360010306
        versionName "0.8.8-Alpha"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
...

For each .aab or .apk file to upload on the console the VersionCode must be different and this number is limited to 2100000000... value.

Specifically in your case, you need to up to your version code to next natural number... But, you must be careful with use random numbers to version, the pattern is elevate number one per one.

7
Fazle Rabbi On

It's a problem with version code. Play store detects previous or same version code in your code. So Just Replace your version code with 360010306. After that may resolve your issue.

2
Fares Laloui On

Update the version code in your project if it was 1 increase to 2 and so on then generate new APK and upload it again to the console.