Cordova VersionCode

0 favourites
  • 14 posts
  • Problem Description

    The exported XML file when using Cordova doesn't include a VersionCode. It'd be nice if this was included within Construct, or even the export section.

    Attach a Capx

    https://1drv.ms/u/s!Am3CPIM7woZ9zh5jsEb-ZZ5XL_zL

    Description of Capx

    But you can literally use any CAPX with an ID and description. This is just a blank capx (with included properties) because rules...

    Steps to Reproduce Bug

    • Open CAPX
    • Export using Cordova
    • Open exported config.xml
    • Note that there's no line regarding the android-versionCode

    Observed Result

    When you upload an APK to Google Play Store, you see a version code. It defaults to 10000. If you then try to upload another APK, Google will throw up an error telling you that you have to upload an APK with a different version code. Note that the version code is different to the version that is included in Construct's Properties section.

    Expected Result

    Within the config.xml file, you're meant to be able to change the version code.

    I added it in the top line, highlighted below in bold.

    version="1.0.0.0" android-versionCode="10001" xmlns="http://www.w3.org/ns/widgets"

    When I add this line in, build an APK and upload it to the store, it's accepted and works. Surely we should be able to edit this within Construct, rather than opening it up after each and every export, adding this line and then going through the normal process. At the very least, this line should be included in the exported XML already. I do note that if I change the "Version" number within Construct, the XML is changed already.

    Again, I emphasise that Version is not the same as VersionCode.

    Affected Browsers

    N/A

    Operating System and Service Pack

    Windows 10

    Construct 2 Version ID

    r249

  • Problem Description

    The exported XML file when using Cordova doesn't include a VersionCode. It'd be nice if this was included within Construct, or even the export section.

    as i said in the other topic https://www.scirra.com/forum/viewtopic.php?f=146&t=198135&start=10 i think this isn't a BUG, if Ashley wants to give an "extra" on C2 export files ok, but it's a gift not a bug.

  • NN81 Jesus, why are you stalking me around the forum? You don't know what you're talking about and Ashley asked me to post this bug. The point of Construct is no coding. ATM, you need to do coding. Go find another project, please.

  • NN81 Jesus, why are you stalking me around the forum? You don't know what you're talking about and Ashley asked me to post this bug. The point of Construct is no coding. ATM, you need to do coding. Go find another project, please.

    i'm not stalking you, the point is that what are you experienced isn't a C2 bug, Ashley suggest you open this topic to a extra feature request, but this must be clear, because the others do not think there is something wrong on C2 export. This is C2 not C3 that offer building apk service.

    C2 versionCode export are fine, if framework used to build apk do not implement correctly the corresponding android version isn't C2 problem.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Filed a C3 issue here.

    NN81, please note I did ask AnD4D to file this.

  • "versioncode" is automatically generated by cordova if absent from config.xml, it bases it on the version attribute which you can set in your project settings.

    [quote:1crvit9w] To change the version code for your app's generated apk, set the android-versionCode attribute in the widget element of your application's config.xml file. If the android-versionCode is not set, the version code will be determined using the version attribute. For example, if the version is MAJOR.MINOR.PATCH:

    versionCode = MAJOR * 10000 + MINOR * 100 + PATCH

    There is a small confusion that we use 4 value version numbers by default for compatibility with certain exporters that require it, but Android uses 3 value numbers. I believe Android doesn't really care about having the extra value, but cordova ignores it when generating the version code.

    +---------+-------------+
    | Version | VersionCode |
    +---------+-------------+
    | 1.0.0.0 | 10000       |
    +---------+-------------+
    | 1.0.0.1 | 10000       |
    +---------+-------------+
    | 1.0.0   | 10000       |
    +---------+-------------+
    | 1.0.1.0 | 10001       |
    +---------+-------------+
    | 1.1.0   | 10100       |
    +---------+-------------+
    | 2.0.0   | 20000       |
    +---------+-------------+[/code:1crvit9w]
  • Nepeo - Thanks for your post. I did, however, change this version number during my export for PhoneGap and it never worked.

    I ended up opening the file up in Android Studio, and while it showed 1.0.0.1, the version code remained 10000. However, that is shown in your table. Therefore, should I have used 1.0.1.0?

    I didn't see that documented anywhere, and did search all over this site and a few others. Is the quote you posted from a manual or tutorial?

    Is this likely to be added to the export for simplicity? As you said, to avoid that small confusion?

    My current build is 0.1.0.1 because I consider it in alpha, but my version code is 10001.

    Thanks again for your reply.

  • AnD4D the last value of the version is ignored, so yes to get 10001 you would have to increment the second value. The documentation is from the cordova CLI, it's the tool we use for generating Android and iOS projects.

    https://cordova.apache.org/docs/en/late ... rsion-code

    For reference you can find the android versioning information here:

    https://developer.android.com/studio/pu ... versioning

    We've been discussing this on the github bug and I think at the moment we're leaning towards adding our own versioncode generator, which would understand the 4 value versioning system. Something like

    MAJOR.MINOR.PATCH.BUILD
    versionCode = MAJOR * 1000000 + MINOR * 10000 + PATCH * 100 + BUILD
    [/code:dj0c28fe]
    
    I think it would also be a good idea to display the version number and version code somewhere during the export, and possibly in the export manager as well.
  • now we know who is "shortercode" aka Nepeo ^_^

    thank you very much for deepening in argument, I had forgotten that the last number was "useless" in Cordova build, and i think thath Phonegap work the same thing when determining versioncode

  • Yup you have discovered my secret alter ego! I use Nepeo for games, I figured it made sense to use it for the forum. Shortercode is for my professional stuff, I was using it before I started at scirra.

    I made a change for r70 so that we now generate the versioncode like above, I haven't updated the build server yet though so it won't respect the value. If your exporting as cordova projects it will be correct though.

  • Yup you have discovered my secret alter ego! I use Nepeo for games, I figured it made sense to use it for the forum. Shortercode is for my professional stuff, I was using it before I started at scirra.

    I made a change for r70 so that we now generate the versioncode like above, I haven't updated the build server yet though so it won't respect the value. If your exporting as cordova projects it will be correct though.

    good!

    i don't know if is a bug but it would also be nice to modify the minsdk codeline version on the config.xml exported file, from 14 to 16 when you choose to export via cordova mobile -> minimum android -> 4.0+ [crosswalk], why building the apk via Cordova CLI i get this error that unable me to build (i use as warkaround export with minimum android "any" instead of "4.0" that don't call minsdk codeline on the config.xml file), or changing manually 14 to 16

  • Nepeo Will this be updated for Construct 2? I've not yet made the leap to Construct 3.

  • You'll need to talk nicely to Ashley for these, he does the cordova exporter for C2.

  • Aww, was hoping this would make it in for the stable build. Oh well. I imagine with the new architecture it's a lot easier to update C3 than C2.

    Think I need to do a bit more research into C3's mobile exporter.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)