Build Android APK automatic version number

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
Posts: 268
Joined: Fri Sep 28, 2012 10:05 am

Build Android APK automatic version number

Post by Ats » Mon Dec 10, 2018 11:32 am

I think it would be great to have an automatic version number button, next to the version number text input. Something like a little clock that will convert the current date to a version number. Because I always forget to set it while compiling, and it's needed by Google play for versioning control.

I'm talking about the android:versionCode, not the pretty android:versionName that is displayed on the user's side.

Here's what I use when making things with HaxeFlixel:

Code: Select all

public static function buildVersion():Int
	var date:Date =;
	//trace(date.getMonth() + 1); // +1 because the month is 0-11 range
	//trace(10000 * date.getFullYear() + 100 * (date.getMonth() + 1) + date.getDate());
	return 100000000 * date.getFullYear() + 1000000 * (date.getMonth() + 1) + 10000 * date.getDate() + 100 * date.getHours() + date.getMinutes();
It returns the current date in the form of YYMMDDhhmm.
But while writing that, I just realized that the max value of an integer is 2,147,483,647 so this will stop working in 2022...
Maybe we should just get YYMMDD or return a string instead of an int. I don't know what kind of value the AndroidManifest android:versionCode should be.

Anyway, here's a better way to organize that: there could be an option in the settings of ZGameEditor to choose what kind of versioning we want:
- Manual
- Automatic increment (which will add +1 at each compilation, very efficient too)
- Automatic date (YYMMDDhhmm)

What do you think of that? How do you guys manage your version number?

Post Reply