Are you getting the below error while uploading your app to the Google Play console?
Version code 1 has already been used. Try another version code.
For every release, the Google Play console demands separate version codes to distinguish app bundles for each release.
You get this error when you upload the app bundle with a version code matching to the previous build version code.
Basically, you have to update the build version for every Android app release.
Note: Don’t get confused with the version code and the Android/iOS app version mentioned in the app.json
.
There are two ways of setting a version inside the Android bundle.
You need to increase the Android versionCode
in the app.json
. If the previous versionCode
is 1, change it to 2.
{ "expo": { "android": { "versionCode": 2 } } }
The default version code is 1 if it is not mentioned.
If you don’t see the versionCode in the app.json, simply set it to 2.
Now for every release, you have to update the version code. If you miss doing it, you will end up wasting your time and energy rebuilding the app again.
Here is the second method to automate this practice.
There is an automated way to do this where expo does it for you.
In the eas.json
, add the field "autoIncrement": true
.
{ "build": { "production": { "autoIncrement": true } } }
When you create the Android build using the expo tool, you will see the versionCode
increase in the app.json
, automatically. This is the beauty of the expo tool.
This is the best-automated way of setting up the version code for each build.
For more details, refer expo doc for app-versions.
Any doubt? Write in the comment section below. Happy coding!
I did this and I’m still having same error.
This is really a strange and it should not be the case.