android-gradle Configure Product Flavors Add dependencies for flavors


Example

You can add different dependencies for a specific product flavor.

Just use the <flavorName>Compile 'group:name:x.y.z' syntax:

android {
    ...    
    productFlavors {
        flavor1 {
           //.....
        }
        flavor2 {
           //.....
        }
    }
}

...
dependencies {

    compile 'com.android.support:appcompat-v7:24.2.0'
   
    // Add a dependency only for flavor1
    flavor1Compile 'group:name:x.y.z'

    // Add a dependency only for flavor2
    flavor2Compile 'group:name:x.y.z'
}