Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
232 views
in Technique[技术] by (71.8m points)

android - How to set build and version number of Flutter app

How do you set the version name and version code of a Flutter app without having to go into the Android and iOS settings?

In my pubspec.yaml I have

version: 2.0.0

but I don't see a place for the build number.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Setting the version and build number

You can update both the version name and the version code number in the same place in pubspec.yaml. Just separate them with a + sign. For example:

version: 2.0.0+8

This means

  • The version name is 2.0.0
  • The version code is 8

This is described in the documentation of a new project (but you might have deleted that if you are working on an old project):

The following defines the version and build number for your application. A version number is three numbers separated by dots, like 1.2.43 followed by an optional build number separated by a +. Both the version and the builder number may be overridden in flutter build by specifying --build-name and --build-number, respectively. Read more about versioning at semver.org.

version: 1.0.0+1

Re-enabling auto versioning

If your Flutter versioning is not automatically updating anymore, see this answer for how to fix it.

See also:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...