This is yet another error that ended up wasting several hours of my time. The error message itself was pretty straightforward:
“Version code 4 has already been used. Try another version code.”
At first, I assumed that simply updating the version on the Play Store would resolve itβbut that didnβt work. I kept running into the same issue every time I tried to upload a new app bundle.
After digging through forums and trying various fixes, I finally discovered that the problem required more than just a Play Store update. You actually need to manually increment the version code in your project files.
The key files that need to be updated are:
pubspec.yaml
β Update the version number here, especially the build number after the+
sign.build.gradle
β Check and update theversionCode
andversionName
inside thedefaultConfig
block.local.properties
β This may cache certain values; update only if the other two changes don’t solve the issue.
Hereβs what I recommend doing, in order:
- Start by modifying the version in
pubspec.yaml
. - If that doesnβt fix it, move on to updating
build.gradle
. - If you’re still stuck, then try updating
local.properties
.
Once you’ve made the necessary changes, make sure to run the following commands to clean up and rebuild your app:
flutter clean
flutter pub get
flutter build appbundle
This fixed the problem for me after hours of frustration. Iβve also included an image below for reference.


