7

My app before using Flutter had

android:versionCode="17"
android:versionName="17"

In my Flutter application in pubspec.yaml, I have to set a version as x.y.z and I am trying set the new version to 19.0.0. But when I try to install the application on my device that has a version with android:versionCode="17" installed, I get an error message saying that the version on device is bigger than version I am trying to install.

How do I fix this?

creativecreatorormaybenot
  • 114,516
  • 58
  • 291
  • 402
burtsevyg
  • 3,851
  • 2
  • 29
  • 44

1 Answers1

10

The flutter.versionCode local property gets populated using the part after the + of the pubspec.yaml version.

This means that for Android, the pubspec.yaml version is parsed as follows:

version: {versionName}+{versionCode}

The example from your questions would consequently look like this in order to work (in pubspec.yaml:

name: ...
version: 19.0.0+19

...

As a side note, it is idiomatic for Dart to follow Semantic Versioning, although the + suffix does not work as it should when trying to build for Android with Flutter as I explained.

creativecreatorormaybenot
  • 114,516
  • 58
  • 291
  • 402