Add dependency to specific productFlavor and buildType in gradle

前端 未结 6 1768
长情又很酷
长情又很酷 2020-12-05 11:31

I\'m wondering how to add dependency to specific productFlavor and buildType in gradle. For example I have productFlavor free and build type release

6条回答
  •  盖世英雄少女心
    2020-12-05 11:51

    Looks like now in version 1 of the android gradle plugin and gradle 2.2+, you can do this with a configuration:

    configurations {
      freeReleaseCompile
    }
    
    android {
       ...
      productFlavors {
        free {
          ...
        }
      }
    }
    
    dependencies {
      freeReleaseCompile('myLib@aar')
    }
    

    Reference: https://groups.google.com/forum/#!msg/adt-dev/E2H_rNyO6-o/h-zFJso-ncoJ

提交回复
热议问题