Android 多种口味和模块

Android 多种口味和模块,android,gradle,android-gradle-plugin,android-productflavors,android-build-flavors,Android,Gradle,Android Gradle Plugin,Android Productflavors,Android Build Flavors,我有一个多模块的应用程序与多个优惠 有没有办法只更改顶级“应用程序”构建变体,并使子模块以相同的方式构建?或者我需要更改每个模块吗 有没有一种方法可以用更少的代码来配置构建类型?这是“愚蠢”的配置 //模块1依赖项配置 flavor1DebugCompile项目(路径:':module1',配置:'flavor1DebugCompile') flavor2DebugCompile项目(路径:':module1',配置:'flavor2DebugCompile') flavor1ReleaseCo

我有一个多模块的应用程序与多个优惠

  • 有没有办法只更改顶级“应用程序”构建变体,并使子模块以相同的方式构建?或者我需要更改每个模块吗

  • 有没有一种方法可以用更少的代码来配置构建类型?这是“愚蠢”的配置

    //模块1依赖项配置
    flavor1DebugCompile项目(路径:':module1',配置:'flavor1DebugCompile')
    flavor2DebugCompile项目(路径:':module1',配置:'flavor2DebugCompile')
    flavor1ReleaseCompile项目(路径:':module1',配置:'flavor1ReleaseCompile')
    Flavor2ReleaseComile项目(路径:':module1',配置:'Flavor2ReleaseComile')

    //模块2依赖项配置
    flavor1DebugCompile项目(路径:':module2',配置:'flavor1DebugCompile')
    flavor2DebugCompile项目(路径:':module2',配置:'flavor2DebugCompile')
    flavor1ReleaseCompile项目(路径:':module2',配置:'flavor1ReleaseCompile')
    Flavor2ReleaseComile项目(路径:':module2',配置:'Flavor2ReleaseComile')

    //模块3依赖项配置

    //模块4依赖项配置
    ...