Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change version code in AndroidManifest.xml using Cordova 3.6.4

I am trying to change the version code in AndroidManifest.xml. I am using Cordova 3.6.4.

As per the docs I am updating it in the config.xml but it is not reflecting in the AndroidManifest.xml after the build.

Config.xml

<widget id="" versionCode="6" version="2.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

AndroidManifest.xml after build

<manifest android:hardwareAccelerated="true" android:installLocation="auto" android:versionCode="20002" android:versionName="2.0.2" package="" xmlns:android="http://schemas.android.com/apk/res/android">
like image 309
Mandeep Pasbola Avatar asked Dec 18 '14 05:12

Mandeep Pasbola


People also ask

Where is Plugin XML in Cordova?

The plugin. xml file is an XML document in the plugins namespace: http://apache.org/cordova/ns/plugins/1.0 .

Does Cordova need Android studio?

Cordova-Android projects can be opened in Android Studio. This can be useful if you wish to use Android Studio's built in Android debugging and profiling tools or if you are developing Android plugins. Note: When opening your project in Android Studio, it is recommended to NOT edit the code within the IDE.


1 Answers

As per Cordova API docs:

Both, Android and iOS support a second version string (or number) in addition to the one visible in app stores, versionCode for Android and CFBundleVersion for iOS.

Below is an example that explicitly sets versionCode and CFBundleVersion

<widget id="io.cordova.hellocordova"
  version="0.0.1"
  android-versionCode="7"
  ios-CFBundleVersion="3.3.3">

If alternative version is not specified, the following defaults will be used:

// assuming version = MAJOR.MINOR.PATCH-whatever
versionCode = PATCH + MINOR * 100 + MAJOR * 10000
CFBundleVersion = "MAJOR.MINOR.PATCH"
like image 141
AAhad Avatar answered Oct 04 '22 02:10

AAhad