我想基于当前的buildType在Android Gradle项目中动态添加依赖项.我知道我可以在依赖项中指定buildType:
compile project(path: ':lib1', configuration: 'debug')
Run Code Online (Sandbox Code Playgroud)
但是,如何使用当前的buildType来指定要导入的库的哪个变体,以便调试版本或发布版本自动导入库的调试版本或发行版本?我想要的是这样的(其中currentBuildType是一个包含当前使用的buildType名称的变量):
compile project(path: ':lib1', configuration: currentBuildType)
Run Code Online (Sandbox Code Playgroud)
我要导入的库项目已设置publishNonDefault true,因此将发布所有buildType.