在Ionic 2/Cordova中设置Android版本代码 [英] Setting Android version code in Ionic 2 / Cordova
问题描述
我完全陷入了一个疯狂的问题.我无法在Google Play商店中发布我的应用程序的更新,因为当前版本代码为 101002 .
I'm completely stuck with a crazy issue. I'm not able to publish an update of my app in Google Play store because current version code is 101002.
现在,我不明白该代码是如何生成的.在我的config.xml中,我尝试使用以下版本:
Now, I don't understand how that code was generated. In my config.xml I tried using the following versions:
1.3
1.3.1
1.3.1.1
但是每次它生成一个版本代码,例如:
but every time it generates a version code like:
10300
10310
10311
始终低于当前版本代码:101002
that is always lower than the current version code: 101002
我还尝试使用以下命令进行构建:
I also tried to build using the following command:
ionic cordova build android --prod --release -- -- --versionCode=103020
但是它不起作用
我无法手动设置清单文件的版本代码,因为它是由ionic 2构建过程生成的.有什么主意吗?
I can't manually set the version code of the Manifest file because it's generated by ionic 2 build process. Any idea?
推荐答案
您可以在config.xml
中指定自定义版本代码.将以下属性添加到<widget>
元素(根元素):android-versionCode="101003"
.
You can specify a custom version-code in config.xml
. Add the following property to the <widget>
element (the root element): android-versionCode="101003"
.
这是完整的<widget>
标记的示例,其中包含可能有用的更多属性:
This is an example of a full <widget>
tag with more properties that are probably useful:
<widget android-versionCode="100" id="your.bundle.id" ios-CFBundleVersion="1.0.0" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
-
version
是应用商店中显示的版本,可以在不同版本之间保持不变 -
android-versionCode
,Google-Play使用它来区分您的内部版本,必须始终高于上一个版本.
iTunesConnect使用 -
CFBundleVersion
来区分您的版本,必须始终高于上一个版本. -
id
是您定义应用程序包标识符的位置,必须始终保持不变 version
is the version displayed in the app stores, can stay the same across different buildsandroid-versionCode
this is used by Google-Play to differentiate between your builds, must always be higher than the previous oneCFBundleVersion
is used by iTunesConnect to differentiate your builds, must always be higher than the previous oneid
is where you define the bundle identifier of your app, this must always stay the same
这篇关于在Ionic 2/Cordova中设置Android版本代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!