android application project中对于debug、release类型不同的编译配置可以通过buildConfig文件实现分离,代码如下:
debug {
buildConfigField "String", "SUFFIX", "\"123\""
}
release {
buildConfigField "String", "SUFFIX", "\"\""
}
但对于android library project(子module),目前的gradle
plugin并不支持debug、release这样的编译类型,如果还是按照如上配置,默认release产生效果,debug被忽略。
android gradle文档是这样说的:
For the rest, libraries behave the same as application projects. They have build
types and product flavors, and can potentially generate more than one