Adding product flavor-specific dependencies
suggest changeDependencies can be added for a specific product flavor, similar to how they can be added for specific build configurations.
For this example, assume that we have already defined two product flavors called free and paid (more on defining flavors here).
The free flavor below gets AppCompat, the ads library, and support-v4. The paid flavor gets Picasso:
android {
...
productFlavors {
free {
applicationId "com.example.app.free"
versionName "1.0-free"
}
paid {
applicationId "com.example.app.paid"
versionName "1.0-paid"
}
}
}
...
dependencies {
...
// Free flavor only
freeCompile 'com.android.support:appcompat-v7:23.1.1'
freeCompile 'com.google.android.gms:play-services-ads:8.4.0'
freeCompile 'com.android.support:support-v4:23.1.1'
// Paid flavor only
paidCompile 'com.squareup.picasso:picasso:2.5.2'
}
...
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents