有没有办法为Flutter应用设置自定义版本名称?

huangapple go评论77阅读模式
英文:

Is there any way to set custom version name for flutter app?

问题

我想设置应用程序的版本名称,类似于1.0.4 beta +4。
但这是不可能的。有没有针对这种版本控制的解决方案?

英文:

I want to set version name of app something like 1.0.4 beta +4.
but it's not possible. Is there any solution for this kind of versioning?

答案1

得分: 0

与许多其他平台不同,移动平台不允许您使用任何您喜欢的版本代码。

如果您阅读有关Android版本控制的信息(https://developer.android.com/studio/publish/versioning)和iOS info.plist的信息(https://developer.apple.com/documentation/bundleresources/information_property_list),您将发现唯一允许的字符是0-9.

通常,在iOS和Android中处理Beta测试的方式是使用单独的构建,并在标识符中使用“beta”关键字来标识它。

因此,如果您的应用通常以以下Bundle ID 标识:com.companyname.app,其Beta版本将是com.companyname.app.beta

此外,还有其他方式,例如Google商店和TestFlight上的Beta发布,但我希望明确基本原理,您还可以查看以下链接以更好地了解Google商店发布的工作方式:https://stackoverflow.com/questions/52760808/google-play-beta-release-to-production-release

英文:

So unlike a lot of other platforms, mobile platforms don't allow you to have whatever you like as version codes.

If you read about versioning on Android https://developer.android.com/studio/publish/versioning and the iOS info plist https://developer.apple.com/documentation/bundleresources/information_property_list you will find that the only allowed characters are 0-9 and .

Generally how you handle beta tests in iOS and Android is by having a separate build and identifying it with the "beta" keyword in the identifier itself

So if your app is generally identified with the following bundle id com.companyname.app its beta release would be com.companyname.app.beta

Also, there are other ways like the beta release on Google Stores and TestFlight but I wanted the premise to be clear, you can also check out this for a better understanding of how google stores releases work https://stackoverflow.com/questions/52760808/google-play-beta-release-to-production-release

答案2

得分: 0

在build.gradle应用模块中,只需在defaultConfig部分中键入所需的版本名称即可。

defaultConfig {
    ...
    targetSdkVersion 33
    versionCode flutterVersionCode.toInteger()
    versionName 1.1.1.custom // 在此处将flutterVersionName更改为自定义版本名称
    ...
}
英文:

Simply typing the desired version name in build.gradle app module worked.

defaultConfig {
    ...
    targetSdkVersion 33
    versionCode flutterVersionCode.toInteger()
    versionName 1.1.1.custom // here change flutterVersionName to custom version name
    ...
}

huangapple
  • 本文由 发表于 2023年5月30日 00:02:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76358773.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定