如何设置Flutter应用程序的内部版本和版本号 [英] How to set build and version number of Flutter app
问题描述
如何在不进入Android和iOS设置的情况下设置Flutter应用的版本名称和版本代码?
How do you set the version name and version code of a Flutter app without having to go into the Android and iOS settings?
在我的pubspec.yaml中,
In my pubspec.yaml I have
version: 2.0.0
但是我看不到内部编号的地方.
but I don't see a place for the build number.
推荐答案
您可以在 pubspec.yaml 中的同一位置更新版本名称和版本代码.只需用+
符号将它们分开.例如:
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
这是
- 版本名称为
2.0.0
- 版本代码为
8
- 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):
以下内容定义了您的应用程序的版本和内部版本号. 版本号是由点分隔的三个数字,例如1.2.43 后跟一个可选的内部版本号,并用+分隔. 版本和构建器编号都可能会在混乱中被覆盖 通过分别指定--build-name和--build-number进行构建. 在semver.org上了解有关版本控制的更多信息.
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
默认情况下,Flutter项目被设置为在构建项目时根据pubspec.yaml中的version
设置自动更新Android和iOS设置.
By default a Flutter project is set up to automatically update the Android and iOS settings based on the version
setting in pubspec.yaml when you build the project.
另请参见:
这篇关于如何设置Flutter应用程序的内部版本和版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!