3 Replies Latest reply on Sep 12, 2016 10:44 AM by jjcseven

    Android version name always 1.0


      We've had a PGB app up for some time and never had any problems with versioning before, but something seems to have changed since moving from 6.1.0-cli to 6.3.0-cli. The Builds tab of the app reports the expected version: 2.3.1. But when I upload the prod APK to the Google Play Store, it is reported as Version 4151 (1.0). The previous version is up as 4150 (2.3.0).


      The version name is set to 2.3.1 in the widget's version attribute, as we always do. The versionCode is incremented, as we always do. The namespace declarations are similarly unchanged. Everything seems to be in line with Config.xml - Apache Cordova  .


      <widget id="our.example.app" version="2.3.1" versionCode="4151" android-versionCode="4151" xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:cdv="http://cordova.apache.org/ns/1.0">


      When I use apktool on the APK, it seems that neither of these values makes it into AndroidManifest.xml — but they weren't included in the previous versions, either. So where is the version name set? How can I correct the version name, either in the config.xml or perhaps by altering and re-signing the APK locally?

        • 1. Re: Android version name always 1.0
          VectorP Level 4

          1. What is the attribute android-versionCode  doing there?

          It should not be an attribute of the widget element, but rather a preference, as in

          <preference name="android-versionCode" value="4151" />

          This is only used in combination with the gradle build tool


          2. The id, version, description and other meta data are specified in the config.xml.

          If your built .apk doesn't contain what was specified, then the odds are that your config was not found, read and parsed, due to:

          - activated Hydration, or

          - wrong directory structure for PGB


          If the former, disable Hydration and rebuild.

          Regarding the latter: can you confirm that you have both config.xml and index.html in the root directory ("/") of your zip file, and that no other file called index.html exists in your assets?

          • 2. Re: Android version name always 1.0
            jjcseven Level 1

            Thanks for the quick response. We've had versionCode and android-versionCode in <widget> since cli-5.2.0. I will try moving the latter to a <preference>. I can confirm that index.html and config.xml are both located in the root, and those are the only files with those names in the install. Hydration is definitely off.

            • 3. Re: Android version name always 1.0
              jjcseven Level 1

              I tried removing the attributes, replacing them with <preference> settings, and with moving the <preference> settings under <platform>. These changes had no effect; when installed on our test devices, and when uploaded to the Google Play Developer Console, the version name was still reported as 1.0.


              But I did discover the problem: a custom GitHub plugin we introduced with this version. The plugin bundled a build.gradle file with a defaultConfig block whose versionName setting seems to have been overriding the version name set in config.xml. I change versionName here to 2.3.1 and this is now reflected when we build the app on PGB. Most of the contents of this file seem to be placeholders or otherwise ignored, so I'll need to work with our plugin developer to see what the best way to handle this is. But at least it's enough to get our release out.