Skip to content

Cordova export: update android-versionCode #1044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AshleyScirra opened this issue Nov 27, 2017 · 6 comments
Closed

Cordova export: update android-versionCode #1044

AshleyScirra opened this issue Nov 27, 2017 · 6 comments
Assignees
Milestone

Comments

@AshleyScirra
Copy link
Member

A user has reported that they cannot update an existing APK without manually editing config.xml to insert android-versionCode: https://www.scirra.com/forum/cordova-versioncode_t198150

If possible we should automatically update this so manual modifications aren't necessary.

@shortercode
Copy link

I'm pretty sure versioncode is optional, cordova generates an android version code using the the version number. Only issue with this is that it only understand 3 value version numbers and we use 4 value. It actually ignores the 4th value completely. I did make an adjustment to prevent 4 value version numbers from being valid in the cordova exporter, but it was removed as it broke compatibility with other exporters.

@shortercode
Copy link

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

@AshleyScirra
Copy link
Member Author

Ah. But could we not generate an android-versionCode ourselves taking in to account the fourth number?

@shortercode
Copy link

I guess, apparently 2100000000 is the maximum value for the versioncode. It would dramatically change the versioncode relative to any older builds, I'm not sure if that'll have any consequences.

Something like:

MAJOR.MINOR.PATCH.BUILD
versionCode = MAJOR * 1000000 + MINOR * 10000 + PATCH * 100 + BUILD

@AshleyScirra
Copy link
Member Author

I think this might be worth a trial to see how it pans out. It would be nice to auto-increment the build number on export if we don't already as well (although it'd need to wrap around after .99, given that version code scheme, unless you shunt everything else up by 10x). Or if not, at least alert the user they need to increment the 3rd number, not the 4th, when exporting again. I'll leave this up to you to decide.

@AshleyScirra AshleyScirra modified the milestones: r71, r70 Nov 28, 2017
@AshleyScirra
Copy link
Member Author

Got this in to r70.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants