简体   繁体   English

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

[英]Setting Android version code in Ionic 2 / Cordova

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 .我无法在 Google Play 商店中发布我的应用程序更新,因为当前版本代码是101002

Now, I don't understand how that code was generated.现在,我不明白该代码是如何生成的。 In my config.xml I tried using the following versions:在我的 config.xml 我尝试使用以下版本:

1.3
1.3.1
1.3.1.1

but every time it generates a version code like:但每次它生成一个版本代码,如:

10300
10310
10311

that is always lower than the current version code: 101002始终低于当前版本代码:101002

I also tried to build using the following command:我还尝试使用以下命令进行构建:

ionic cordova build android --prod --release -- -- --versionCode=103020

but it doesn't work但它不起作用

I can't manually set the version code of the Manifest file because it's generated by ionic 2 build process.我无法手动设置 Manifest 文件的版本代码,因为它是由 ionic 2 构建过程生成的。 Any idea?任何的想法?

You can specify a custom version-code in config.xml .您可以在config.xml指定自定义版本代码。 Add the following property to the <widget> element (the root element): android-versionCode="101003" .将以下属性添加到<widget>元素(根元素): android-versionCode="101003"

This is an example of a full <widget> tag with more properties that are probably useful:这是一个完整的<widget>标签示例,其中包含更多可能有用的属性:

<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 is the version displayed in the app stores, can stay the same across different builds version是应用商店中显示的版本,可以在不同版本中保持相同
  • android-versionCode this is used by Google-Play to differentiate between your builds, must always be higher than the previous one android-versionCode这是 Google-Play 用来区分您的构建的,必须始终高于前一个
  • CFBundleVersion is used by iTunesConnect to differentiate your builds, must always be higher than the previous one iTunesConnect 使用CFBundleVersion来区分您的构建,必须始终高于前一个
  • id is where you define the bundle identifier of your app, this must always stay the same id是您定义应用程序包标识符的地方,它必须始终保持不变

If you compile your project with Android Studio, you can change it in the App-> Manifests-> AndroidManifest.xml folder如果你用Android Studio编译你的项目,你可以在App-> Manifests-> AndroidManifest.xml文件夹中修改

截屏

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 离子 cordova 运行 android 和 java 版本 - ionic cordova run android and java version android版本代码android版本名称cordova - android version Code android version name cordova Android - Cordova版本代码问题 - Android - Cordova version code issue 离子 cordova - Cors 不适用于较新版本的 android,但它适用于 ZC31B32364CE19CA58FCD15068Z7 - Ionic cordova - Cors not working on newer version of android, But its working on android 7 or 6 ionic cordova运行android失败,在ionic 3中退出代码为1 - ionic cordova run android failed with exit code 1 in ionic 3 在Android中为ionic / Cordova应用程序设置支持屏幕 - Setting supports-screens for ionic/ Cordova app in Android 在 android 版本 9 或更高版本中运行时,Ionic Cordova 语音识别不起作用 - Ionic Cordova Speech Recognition not working when running in android version 9 or higher Ionic / Cordova-如何在Play商店中设置“需要Android”版本? - Ionic / Cordova - How to set the 'Requires Android' version in Play Store? 你如何为 ionic/cordova 构建和部署到旧版本的 android - How do you build and deploy to an older version of android for ionic / cordova Apache Cordova,离子和聚合物纸元素:Android版本 - Apache cordova, ionic & polymer paper elements : android version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM