本文介绍了Flutter:升级 Play 商店的版本代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用flutter在Play商店发布了一个应用程序,现在我想上传该应用程序的新版本.我正在尝试更改版本代码:

I have published an application on the play store with flutter, now I want to upload a new version of the application. I am trying to change the version code with:

flutter build apk --build-name=1.0.2 --build-number=3

或者像这样改变local.properties

or changing the local.properties like this

 flutter.versionName=2.0.0
 flutter.versionCode=2
 flutter.buildMode=release

但是每次我在 Play 商店出现错误时

but every time I get an error on the play store

您必须为您的 APK 或 Android App Bundle 使用不同的版本代码,因为代码 1 已分配给另一个 APK 或 Android App Bundle.

推荐答案

更新 pubspec.yaml 中的 version:A.B.C+X.

Update version:A.B.C+X in pubspec.yaml.

安卓:

A.B.C 代表versionName1.0.0.

X(+后面的数字)代表versionCode123

X (the number after the +) represents the versionCode such as 1, 2, 3, etc.

不要忘记在这一步之后执行flutter build apkflutter run,因为:当你运行flutter build apkflutter runpubspec 文件中更新此 version 后,versionNamelocal.properties 中的 versionCode 被更新,当你使用 flutter build 构建你的 flutter 项目时,它会在 build.gradle (app) 中被更新apkflutter run 最终负责为 apk 设置 versionNameversionCode.

Do not forget to execute flutter build apk or flutter run after this step, because: When you run flutter build apk or flutter run after updating this version in the pubspec file, the versionName and versionCode in local.properties are updated which are later picked up in the build.gradle (app) when you build your flutter project using flutter build apk or flutter run which is ultimately responsible for setting the versionName and versionCode for the apk.

对于 iOS:

A.B.C 表示CFBundleShortVersionString1.0.0.

X(+后面的数字)代表CFBundleVersion123

X (the number after the +) represents the CFBundleVersion such as 1, 2, 3, etc.

不要忘记在这一步之后执行flutter build ipaflutter run

这篇关于Flutter:升级 Play 商店的版本代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 07:56