You need to use a different version code for your APK problem

We are developing an app using Ionic and Capacitor. Builds are generated using Ionic’s new AppFlow service, so I don’t build them locally.

Uploading my app with a new package I get:
“You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1.”

How do I go about updating the Android code version number? I’ve tried updating the config.xml, but all updates result in a version number of “1.0”, regardless of what I do.

Thank you!
Stfb.

Change in your config.xml

version="1.0" to version="1.1"

And rebuild the app! :slight_smile:

I already tried that but it’s not working. Still getting the same message… :frowning:

If anyone is still looking for this, and you are using cordova, you can use this: https://www.npmjs.com/package/cordova-set-version in combination of adding a hook or a man-in-the-middle “build” script to your package.json.

the appflow is just using npm to install your packages and uses the build script to build your webcode like angular or react. if you make your own script to do that, you can add some functionality it should do before it get’s actually build. You can then modify the config.yml file yourself or with the package I mentioned above. That script will also modify the versioncode for iOS.

See also here for more information on custom scripts: https://ionicframework.com/docs/appflow/automation/environments

The part that actually builds your android app is cordova (which is of course using gradle), thus if you are looking for a way, you are looking for a way in cordova. If you have capacitor, you find a way in capacitor. It is not Ionic specific.