With the release of Apache* Cordova* CLI 5 by the Apache Cordova project, there was a change to how "App Version Codes" are written inside the Android and Android-Crosswalk APK files built with CLI 5 by the Intel XDK. The App Version Code is directly related to the Build Settings section of the Projects tab, and corresponds to the android:versionCode parameter found in the AndroidManifest.xml file of every Android and Android-Crosswalk APK:
In the past (CLI 4.1.2 and earlier), Cordova did not modify the Android version code, so the android:versionCode found in your Android APK was identical to the value provide (above) in the App Version Code field. However, in order to support the submission of multiple Android-Crosswalk APK files (e.g., ARM and x86) to an Android store, the Intel XDK build system did modify the version code for Android-Crosswalk embedded builds.
The "historic" behavior regarding the final Android version code that was inserted in your built APK files, when built with the Intel XDK using CLI 4.1.2 (or earlier) is:
- no change to the version code for regular Android builds (android:versionCode = App Version Code)
- no change to the version code for Android-Crosswalk shared library builds
- add 60000 to the version code for Android-Crosswalk x86 embedded library builds
- add 20000 to the version code for Android-Crosswalk ARM embedded library builds
So that means you will see the following android:versionCode values inside your built APK if you set the App Version Code field to one in the Build Settings section of the Projects tab and set the CLI version to 4.1.2:
- "1" for a regular Android build
- "1" for an Android-Crosswalk shared library build
- "20001" for an Android-Crosswalk embedded library ARM build
- "60001" for an Android-Crosswalk embedded library x86 build
Beginning with Cordova CLI 5, in order to maintain compatibility with standard Cordova, the Intel XDK no longer modifies the android:versionCode when building for Android-Crosswalk. Instead, the new Cordova CLI 5 encoding technique has been adopted for all Android builds. This change results in a discrepancy in the value of the android:versionCode that is inserted into your Android APK files when compared to building with CLI 4.1.2 (and earlier).
If you have never published an app to an Android store this change in behavior will have little or no impact on you. It might affect attempts to side-load your app onto a device, in which case the simplest workaround is to uninstall the previously side-loaded app before installing the new app. For those who have Android apps in stores that have been built with Cordova CLI 4.1.2 or earlier, please read on...
Here's what Cordova CLI 5 (Cordova-Android 4.x) does with the android:versionCode number (which you specify in the App Version Code field within the Build Settings section of the Projects tab):
- multiplies your android:versionCode (App Version Code) by 10
then, if you are doing a Crosswalk (15+) build (with CLI 5):
- adds 2 to the android:versionCode for ARM builds
- adds 4 to the android:versionCode for x86 builds
otherwise, if you are performing a standard Android build (non-Crosswalk):
- adds 0 to the android:versionCode if the Minimum Android API is < 14
- adds 8 to the android:versionCode if the Minimum Android API is 14-19
- adds 9 to the android:versionCode if the Minimum Android API is > 19 (i.e., >= 20)
So that means you will see the following android:versionCode values inside your built APK if you set the App Version Code field to one in the Build Settings section of the Projects tab and set the CLI version to 5.1.1 (or higher):
- "10" for a regular Android build if the android:minSdkVersion is < 14
- "18" for a regular Android build if the android:minSdkVersion is 14-19
- "19" for a regular Android build if the android:minSdkVersion is > 19
- "12" for an Android-Crosswalk embedded library ARM build
- "14" for an Android-Crosswalk embedded library x86 build
- "TBD" for an Android-Crosswalk shared library build (not fully supported at this time)
NOTE: the Minimum Android API field in the Build Settings section of the Projects tab sets the value of the android:minSdkVersion number shown in the bullets above.
If you HAVE ALREADY PUBLISHED a Crosswalk app to an Android store this change may impact your ability to publish a newer version of that same app! In that case, if you are still building for Crosswalk, add 6000 (six with three zeroes) to your existing App Version Code field in the Crosswalk Build Settings section of the Projects tab.
If you have only published standard Android apps in the past and are still publishing only standard Android apps you should not have to make any changes to the App Version Code field in the Android Builds Settings section of the Projects tab.
The workaround described above only applies to Crosswalk CLI 5.1.1 (and higher) builds!
When you build with CLI 4.1.2 (which uses Cordova-Android 3.6) you will get the old Intel XDK behavior where: 60000 and 20000 (six with five zeros and two with five zeroes) are added to the android:versionCode for Crosswalk builds and no change is made to the android:versionCode for standard Android builds.
NOTE:
- Android API 14 corresponds to Android 4.0
- Android API 19 corresponds to Android 4.4
- Android API 20 corresponds to Android 5.0
- CLI 5.1.1 (Cordova-Android 4.x) does not allow building for Android 2.x or Android 3.x