How to set build and version number of Flutter app

前端 未结 5 1862
悲哀的现实
悲哀的现实 2020-12-29 19:55

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

v         


        
5条回答
  •  梦毁少年i
    2020-12-29 20:40

    Updating the app’s version number

    The default version number of the app is 1.0.0. To update it, navigate to the pubspec.yaml file and update the following line:

    version: 1.0.0+1
    

    The version number is three numbers separated by dots, such as 1.0.0 in the example above, followed by an optional build number such as 1 in the example above, separated by a +.

    Both the version and the build number may be overridden in Flutter’s build by specifying --build-name and --build-number, respectively.

    In Android, build-name is used as versionName while build-number used as versionCode. For more information, see Version your app in the Android documentation.

    After updating the version number in the pubspec file, run flutter pub get from the top of the project, or use the Pub get button in your IDE. This updates the versionName and versionCode in the local.properties file, which are later updated in the build.gradle file when you rebuild the Flutter app.

    Docs : https://flutter.dev/docs/deployment/android#updating-the-apps-version-number

提交回复
热议问题