androidreact-nativeexpogoogle-playeas

Expo EAS Build: Google Play Console says "Version code 1 has already been used" even after setting versionCode


I'm using Expo EAS Build for a React Native app and trying to upload my .aab to the Google Play Console (internal testing track).

I keep getting this error when uploading:

Version code 1 has already been used. Try another version code.

What I've Done:

I added "versionCode": 3 inside the android block of my app.json.

Later, I switched to app.config.js, which already existed, to customize the config and set versionCode programmatically like this:

module.exports = ({ config }) => ({
  ...config,
  expo: {
    ...config.expo,
    android: {
      ...(config.expo?.android || {}),
      versionCode: 3,
      package: 'com.anonymous.lifelog',
    },
  },
});

I confirmed this file is in the project root and included a console.log() to print the final config during EAS build.

However, in the EAS build logs, I don't see versionCode anywhere, and Google Play keeps rejecting my AAB as if it’s still using versionCode: 1.

✅What I'm Trying to Understand:

❓ Why is versionCode not being applied to the .aab in EAS builds?

❓ How can I verify that EAS is actually using my app.config.js?

❓ Is there a better way to ensure versionCode is incremented and applied during the build?

Any help is appreciated — thank you!

****UPDATE Thanks Lasse for the answer. This is what I did Thanks Realsima! That work.for me.

If anyone is using Expo EAS Build and get the error: "Version code 1 has already been used. Try another version code."

This means the versionCode in your .aab file hasn’t incremented — which Google Play requires for every new release.

The Expo EAS Dashboard shows your version like this:> Version: 1.1.0 (1) So (1) means your versionCode is still 1 — and that will be rejected if already used.

Use Expo’s autoIncrement feature in your eas.json file to fix this automatically:

{

"build": {

"production": {

"android": {

"autoIncrement": true

},

"ios": {

"autoIncrement": true

}

}

}

}

Then remove any hardcoded android.versionCode from your app.config.js or app.json if there.:tools: Optional: Run this command to check what config Expo is reading:

npx expo config --type prebuild

If versionCode still shows as 1, you're either:

Overriding it in app.config.js, or

Your config isn’t being picked up.


Solution

  • You can set the autoIncrement in your eas.json file to handle versionCode automatically, when building. https://docs.expo.dev/eas/json/