Wir*_*ing 6 configuration dependencies android gradle android-build-flavors
我有一个具有多种风味维度的应用程序:
以及常见的构建类型:debug和release
这会产生构建变体的完整列表:
然后我可以为这样的构建变体设置特定的依赖关系。
android {
configurations {
vipTestReleaseImplementation
// dozens of other configurations.
}
dependencies {
vipTestReleaseImplementation fileTree('my_test_library')
// dozens of dependencies.
}
}
Run Code Online (Sandbox Code Playgroud)
但这并不理想,因为我必须写下每一个组合,最终会得到数十种配置。
有没有办法定义 buildType 与特定维度的依赖关系?就我而言,环境维度?像这样:
android {
configurations {
// these configurations don't exist.
testReleaseImplementation
acceptanceReleaseImplementation
productionReleaseImplementation
}
dependencies {
debugImplementation fileTree('my_debug_library')
// this would be nice but is not possible???
testReleaseImplementation fileTree('my_test_library')
acceptanceReleaseImplementation fileTree('my_test_library')
productionReleaseImplementation fileTree('my_prod_library')
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用 avariantFilter但它只是迭代每个构建变体,所以我最终得到了重复的依赖项。我该如何解决这个问题?
| 归档时间: |
|
| 查看次数: |
440 次 |
| 最近记录: |