gradle-gitVersioner-plugin icon indicating copy to clipboard operation
gradle-gitVersioner-plugin copied to clipboard

GitVersioner conflicts with Instant Run

Open Syex opened this issue 7 years ago • 1 comments

GitVersioner includes the number of changes in the versionName, so with (almost) every build the versionName changes to something like

android:versionName = 500-feature/my_awesome_feature-SNAPSHOT(2 +3 -5)

This forces Instant Run to always do cold swaps, restarting the whole app for small changes like adding layout attributes, because the AndroidManifest has changed.

It would be desirable that the versionName for Instant Run builds doesn't change or there is an option to disable the suffix including the amount of changes in the versionName.

Syex avatar Sep 20 '17 12:09 Syex

You should not use dynamic version names and code when you develop. You could add a beta build, which you can send to your testers.

buildTypes 
{
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        defaultConfig.versionCode gitVersioner.versionCode
        defaultConfig.versionName gitVersioner.versionName
    }
    debug {
        applicationIdSuffix ".debug"
        debuggable true
    }
    beta {
        initWith debug
        //manifestPlaceholders = [hostName:"internal.example.com"]
        applicationIdSuffix ".beta"
        matchingFallbacks = ['debug', 'release']
        defaultConfig.versionCode gitVersioner.versionCode
        defaultConfig.versionName "BETA_" + gitVersioner.versionName
    }
}

matthiasbruns avatar Jan 01 '18 12:01 matthiasbruns