我想知道如何在 gradle 中添加对特定 productFlavor 和 buildType 的依赖。
例如我有productFlavor free
和构建类型release
,如何添加对assembleFreeRelease
任务的依赖?
我尝试了许多变体,但都不起作用。
例如我试过:
task('release', dependsOn: assembleProductionRelease) {
}
// error: Could not find property 'assembleProductionRelease' on root project 'app'.
或者:
task('release', dependsOn: 'assembleProductionRelease') {
}
这里没有错误,但是任务是针对每种风格和构建类型执行的,非常困惑。
最佳答案
有对 flavor 和 buildType 依赖项的内置支持。
dependencies {
flavor1Compile "..."
freeReleaseCompile "..."
}
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Sourcesets-and-Dependencies
关于android - 在 gradle 中添加对特定 productFlavor 和 buildType 的依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19589342/