Monday, 19 February 2018

Configure Build Variants in Android Gradle

 Want to make Multiple Flavour of an Andoid App ?

       Yes the solution is configure your build variant with diffrent flavours .




Build variant represents a different version of your app , Like one is debug app and one is release app
Like you want to create paid app  with no advertisement and free app with
advertisement , then build variant is the solution .

Build different versions of android app that is targeting different devices, based on API compatibility.

Configure Build Type

android {
    defaultConfig {
        manifestPlaceholders = [hostName:"http://stacklearning.blogspot.in/"]
        ...
    }
    buildTypes {
        release {  // this is relase build type
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug { // this is debug
            applicationIdSuffix ".debug"
            debuggable true
        }
    }
}

However you can create "dev" build type also .

dev { // this is dev
            applicationIdSuffix ".dev"
            debuggable true
        }
    } }


1 comment:

  1. Thanks a lot for sharing this amazing knowledge with us. This site is fantastic. I always find great knowledge from it.  Javascript Online Tutorial

    ReplyDelete