Bilal Yaqoob
Bilal Yaqoob

Reputation: 998

React native Expo Version code 1 has already been used. Try another version code

After updating my app I am trying to upload my expo app to the playstore but getting error again and again. I changed the version in app.json version": "2.0.0" and also try this version": "1.0.1" and version": "1.0.2". I have no idea why it is showing me this error.

Answer The ios.buildNumber and android.versionCode distinguish different binaries of your app. Make sure to increment these for each build you upload to the App Store or Google Play Store.

Upvotes: 14

Views: 13820

Answers (2)

Given
Given

Reputation: 775

There is an automated way to do this where expo does it for you. It prevents wasting time & resources of rebuilding again when you forget to update those versions.

In the eas.json the "autoIncrement": true does the trick!

{
  "cli": {
    "appVersionSource": "remote"
  },
  "build": {
    "staging": {
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      }
    },
    "production": {
      "autoIncrement": true
    }
  }
}

here is more on the docs with another option for local instead of remote: https://docs.expo.dev/build-reference/app-versions/

Upvotes: 19

Anthony
Anthony

Reputation: 568

You need to increase the android versionCode and iOS buildNumber, not the version string.

"ios": {
  "bundleIdentifier": "com.yourcompany.yourappname",
  "buildNumber": "1.0.0" //increase it for iOS
},
"android": {
  "package": "com.yourcompany.yourappname",
  "versionCode": 1 //increase it for android
}

Upvotes: 28

Related Questions