在 Ionic 2/Cordova 中设置 Android 版本代码

Setting Android version code in Ionic 2 / Cordova(在 Ionic 2/Cordova 中设置 Android 版本代码)
本文介绍了在 Ionic 2/Cordova 中设置 Android 版本代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我完全陷入了一个疯狂的问题.我无法在 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

但它不起作用

我无法手动设置 Manifest 文件的版本代码,因为它是由 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 用来区分您的构建的,必须始终高于前一个
  • CFBundleVersion 由 iTunesConnect 用于区分您的构建,必须始终高于前一个
  • id 是您定义应用程序包标识符的位置,它必须始终保持不变
    • version is the version displayed in the app stores, can stay the same across different builds
    • android-versionCode this is used by Google-Play to differentiate between your builds, must always be higher than the previous one
    • CFBundleVersion is used by iTunesConnect to differentiate your builds, must always be higher than the previous one
    • id is where you define the bundle identifier of your app, this must always stay the same
    • 这篇关于在 Ionic 2/Cordova 中设置 Android 版本代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

      本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
cocos2d-android: how to display score(cocos2d-android:如何显示分数)
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
Android file copy(安卓文件拷贝)
Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)