[英]Android Gradle how to custom sourceSet in library by product flavor?
Here's my main project structure:这是我的主要项目结构:
App/src
- main
- flavor1
- flavor2
- dimension1
- dimension2
- debug
- release
Both flavor* and dimension* are flavor dimensions.风味* 和维度* 都是风味维度。 The build variants are:构建变体是:
flavor1Dimension1Debug
flavor1Dimension2Debug
flavor2Dimension1Debug
...
And library's dir structure:和图书馆的目录结构:
Lib/src
- main
- flavor2
- DebugInterceptor.java
- debug
- DebugInterceptor.java
- release
- DebugInterceptor.java
What I want:我想要的是:
src/flavor2/DebugInterceptor.java
.如果变体包含“flavor2”,则此变体应使用src/flavor2/DebugInterceptor.java
。 It should take higher priority than build types.它应该比构建类型具有更高的优先级。 You can assume that these three dirs(flavor2, debug, release) contain only one file DebugInterceptor.java
你可以假设这三个目录(flavor2, debug, release)只包含一个文件DebugInterceptor.java
How can I configure gradle to achieve this?如何配置 gradle 来实现这一点?
use only one dimension and multiple flavor, don't use multiple dimension or remove code from dimension, dimension is not suitable for code but for other configs like api level仅使用一维和多种风格,不要使用多维或从维度中删除代码,维度不适用于代码,但适用于 api 级别等其他配置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.