前两天提交了一个版本Google Play,结果今天收到拒绝的邮件,说App内购有问题。
于是把设置里面的支付宝和微信打赏功能关闭,又打了一个aab。
然后上传到Google Play,结果提示
You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1.
一开始尝试修改App内部的版本号,就在pubspec.yaml中。
修改为,最开始是1.0.0
version: 1.0.1
还是不行,提示同样的错误。
Google了一下,结果方法很简单,在刚才的pubspec.yaml中,
版本号加一个+1即可。因为第一次上传的Version Code是1。这个在Play Console中可以看见。
version: 1.0.0+2
然后就可以上传了。
StackOverflow解释:
For Android:
A.B.C
represents the versionName
such as 1.0.0
.
X
(the number after the +
) represents the versionCode
such as 1
, 2
, 3
, etc.
When you run flutter packages get
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
or flutter run
which is ultimately responsible for setting the versionName
and versionCode
for the apk.
For iOS:
A.B.C
represents the CFBundleShortVersionString
such as 1.0.0
.
X
(the number after the +
) represents the CFBundleVersion
such as 1
, 2
, 3
, etc.
参考: