Ade
Ade

Reputation: 3041

Cordova Android build versionCode with Gradle

I have an existing Cordova app that I am updating. The Cordova versions are: Cordova 6.3.0 and cordova-android 5.2.2 Google Play has started saying:

"Upload failed. Your APK's version code needs to be higher than 2016032518"

(2016032518 is the currently released version).

My config.xml contains this:

<widget android-versionCode="201608291" ios-CFBundleVersion="201608291" version="1.5.0"

I am building with cordova build android --release

The AndroidManifest (in platforms/android/AndroidManifest.xml) contains the correct versionCode:

<manifest android:hardwareAccelerated="true" android:versionCode="201608291" android:versionName="1.5.0"

I have tried:

  1. Adding versionCode 201608291 inside the defaultConfig {} block in build.gradle

  2. Specifying the versionCode in the the build command like cordova build android --release --versionCode=201608291

Given that the file platforms/android/AndroidManifest.xml contains the correct versionCode it seems that the built APK file does NOT have the right version.

How can I solve this?

How can I even see what version the compiled APK has?

Upvotes: 0

Views: 567

Answers (1)

Vladyslav Matviienko
Vladyslav Matviienko

Reputation: 10881

Pay attention to the numbers:

android:versionCode="201608291"

201608291 has 1 digit less than 2016032518

VersionCodes are comparesd as integer values, so 201608291 is really lower than 2016032518

Upvotes: 1

Related Questions