Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 216
Bilal Yaqoob Avatar asked Dec 20 '25 07:12

Bilal Yaqoob


2 Answers

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
}
like image 171
Anthony Avatar answered Dec 22 '25 19:12

Anthony


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/

like image 41
Given Avatar answered Dec 22 '25 21:12

Given



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!