android - gradle multiproject include and exclude libraries -


i trying build android project gradle.

it has following structure:

projecta----- mainproject,    liba     ---- library project,    libb     ---- library project,    libc     ---- library project,    libd     ---- library project,   etc... 

based on situtation, need include libraries, need include libraries, 1 library, 2 or 3 etc. based on flavors. in settings file have included projects.

does know how include/exclude libraries based on flavors?

i have tried on dependency block, there getting error.
following sample code

dependencies { if (task.name.matches('compileflovor1'){   exclude module: 'libd'    } } 

error is: not find method exclude() arguments [{module=libd}].

please guide me resolving issue

do add flavour specific dependencies must configure according configuration. let's have flavours "free" , "payed"

android {     productflavors {         free         paid     } } 

then can set flavour specific dependencies in dependency block in following way:

dependencies {     compile project(':library1')  //library1 used in free , paid flavour     freecompile project(':library2')     paidcompile project(':library3')         paidcompile project(':library4')         paidcompile project(':library5')      } 

hope helped,

cheers, rené


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -