Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter pubspec.yaml Android versionCode

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?

like image 264
burtsevyg Avatar asked May 31 '19 14:05

burtsevyg


1 Answers

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.

like image 159
creativecreatorormaybenot Avatar answered Nov 20 '22 10:11

creativecreatorormaybenot