19 December 2024 Leave a comment Tech-Help
When attempting to upload a new app bundle to the Google Play Console, developers often encounter the error message: “Version code 1 has already been used. Try another version code.” This issue arises when the version code in the app bundle conflicts with a previous submission.
Understanding Version Codes
Version codes are internal identifiers used by the Google Play Store to differentiate between different versions of an app. They are not visible to users but are crucial for managing app updates. Each new release of your app must have a unique version code.
Common Solutions
Solution 1: Manage App Bundles
If you are still seeing the error despite updating your version code, it might be due to a draft app bundle with the same version code. Follow these steps to resolve the issue:
- Navigate to the Release section of your Play Console.
- Select App Bundle Explorer from the options available.
- In the top-right corner, find the dropdown for your app versions and click on it.
- Locate the app bundle with the conflicting version code and delete it.
- If there is no option to delete the app build, consider deleting your releases from the production tab.
Solution 2: Update Version Code Manually
Another approach is to manually update the version code in your project files. Here’s how you can do it:
- Open the
build.gradle
file located atapp_name/android/app/
. - In the
defaultConfig
section, increment theversionCode
to a higher number. - Similarly, update the
versionName
if needed.
For Flutter Projects
For developers using Flutter, the version code can be updated directly in the pubspec.yaml
file:
- Locate the
version
key in thepubspec.yaml
file. - Change the value after the
+
sign to a higher number, for example, fromversion: 1.0.0+1
toversion: 1.0.0+2
.
Leveraging Repeato for Efficient App Testing
When managing app versions and ensuring error-free releases, automated testing can be a game-changer. Repeato, our no-code test automation tool for iOS and Android, allows you to create, run, and maintain automated tests for your apps efficiently. Its computer vision and AI capabilities make it particularly fast to edit and run tests, ensuring that your app updates are thoroughly tested before reaching users. For more information on how Repeato can streamline your testing process, check out our Flutter Test Automation documentation.
For more articles and resources on app development and testing, visit our Blog.