【发布时间】:2014-09-09 07:41:53
【问题描述】:
我想根据当前的 buildType 在 Android Gradle 项目中动态添加依赖项。我知道我可以specify the buildType in the dependency:
compile project(path: ':lib1', configuration: 'debug')
但是如何使用当前的 buildType 来指定要导入的库的哪个变体,以便调试或发布版本自动导入库的调试或发布变体?我想要的是这样的(其中 currentBuildType 是一个包含当前使用的 buildType 名称的变量):
compile project(path: ':lib1', configuration: currentBuildType)
我要导入的库项目设置了publishNonDefault true,所以所有的buildTypes都被发布了。
【问题讨论】:
标签: android android-gradle-plugin