How to set Capacitor Android versionCode for AppFlow

I have not been able to find a sufficient answer to this question. Every solution I have found says to modify the build.gradle file in the android folder. This only works for local builds, since if I commit those platform specific folders to git and then trigger an AppFlow build, it breaks because the files already exist.

I found this thread where several of the users mention what the correct solution should be, which is to set it in the top level config file.

I’m curious how AppFlow users are currently getting around the issue where Google Play won’t accept any additional builds because they’re all version coded as 1?

When you say “it breaks because the files already exist” what is the exact error that Appflow displays?


[brought over my answer to your question from another thread]

It’s true that currently, Capacitor doesn’t have a version number property that you can sync over, like Cordova has in config.xml. So, you’d:

  • Make a code change.
  • Update the version number in AndroidManifest.xml.
  • Commit those changes to source control
  • Create a new native Android build in Appflow
  • and so forth…