Tag Archives: apps

Android, Smartphone, Android Developer, Android Studio

Auto ‘versionCode’ increment when building production apk’s

Since I adopted Fabric as a way to monitor vital app stats such as ‘Time in App per User‘ and it’s Beta distribution platform to distribute test builds, increasing APK’s versionCode numbers became a tedious task.

I decided to simplify the things by letting Gradle to do auto versionCode increments when producing release APK’s

Our implementation of build number increments will consist of a property file named version.properties located in the root folder of our project.

The property file will contain 2 variables, one defining the version name such as “2.3” and one defining the version code such as 15

VERSION_NAME=2.3
VERSION_CODE=19

In our app module build.gradle file

build.gradle

we will define a function which takes care of retrieving the a bough mentioned values from the properties file and increment the VERSION_CODE if needed.

/**
 * Get's value from 'version.properties' file
 * @param varName the name of the variable which value we wan't to get.
 * @return the variable value.
 */
def getVersionPropertiesValue(def varName)
{
    def propertiesFile = file('version.properties')
 
    if(!propertiesFile.canRead()) {
        throw new GradleException("Could not read " + propertiesFile.name)
    }
 
    Properties properties = new Properties();
    properties.load(new FileInputStream(propertiesFile))
 
    def propertyValue = properties[varName]
    if(varName == 'VERSION_CODE')
    {
        // If we are building release increment the version code
        List gradleTasksNames = gradle.startParameter.getTaskNames();
        for(String taskName : gradleTasksNames)
        {
            if(taskName.contains("Release"))
            {
                propertyValue = propertyValue.toInteger() + 1
                properties[varName] = propertyValue.toString()
                properties.store(propertiesFile.newWriter(), null)
                break
            }
        }
    }
 
    return propertyValue
}

In the defaultConfig section of the gradle build script we will call this function to retrieve values for the versionName and versionCode of our app.

android {
    compileSdkVersion 28
 
    defaultConfig {
        applicationId "com.example.foo"
        versionCode Integer.valueOf(getVersionPropertiesValue('VERSION_CODE'))
        versionName getVersionPropertiesValue('VERSION_NAME')
        minSdkVersion 14
        targetSdkVersion 28
    }
}

Now each time a release build is made, the version code will increment automatically. If we want to change the version name we can do so by changing the value of VERSION_NAME property.

I brought myself a Christmas present

After being upgraded to June 2017 iMac 27″ 5k Retina at work, and using it for a week, I decided it’s about time to purchase myself an iMac. My first impression with this machine is fantastic, everything just works (fast and smooth) and the 5K Retina is amazing.

Today (after being financially stable, after some time 🙂 ) I ordered 27″ iMac 5K Retina equipped with 4.2GHz Quad-Core Intel Core i7, 16GB 2400MHz DDR4 (will be upgraded to 32 or 64 GB later), 2TB Fusion Drive and Radeon Pro 580 with 8GB VRAM.

It will arrive around 20 Jan 2018. It will be a nice time to start developing apps for iOS and bring VMSoft to the app store as well. Also a lot of my clients were asking me when will I start developing for iOS.

Alien Swarm 1.4.1 out now!

Alien Swarm version 1.4.1 is out now!

This is the best ‘Alien Swarm’ release to date. Featuring Facebook and Google+ share integration, so you can share your experience with friends and family. Sound and performance improvements, few bug fixes and more. Check it out!

Version 1.4.1 Change Log:
* Facebook and Google+ share improvements.
* Fixed visual bug when the game is running on tablets with Android 2.3.x
* Fixed crash when running on devices with Android 2.3.x
* Removed the ‘-1’ sign when hitting an enemy with a health bar.
* Sound improvements
* Small apk size reduction
* Reduced start up time

google-play-badge

Alien Swarm 1.4 out now!

feature_graphic

Alien Swarm version 1.4 brings our ‘shoot everything that moves’ game on the big screen!

The game is now available for Android TV. This update also features sound quality / performance improvements.

google-play-badge

NOTE: Playing on Android TV requires game pad.

Happy Fruits is out now!

Happy Fruits is out now!

Happy Fruits is a simple match-3 puzzle game similar to Jewels / Bejeweled type of games.
Your goal is to swap adjacent fruits to create combinations of 3 or more fruits of the same color and type, horizontally or vertically.

When you match 4 or more fruits, horizontally or vertically the whole game field row or column is removed.

After removing fruits new fruits drop down on the game field. Quite often the falling fruits create new valid combinations causing a chain reaction (or cascade).

Features:
* 3 game modes: Normal, Timed and Endless
* Hints
* Infinite number of levels
* Saved games. Store your progress and resume playing later on.
* Android TV support
* Game pad support
* “Optimized for your device” graphics
* In game stats
* In game help

It’s free on the Google Play Store.

google-play-badge