我有几种构建类型:debug, release. 我也有两种口味pub和dev.
pub调味的应用程序取决于pub库,类似的dev味道.现在,我希望debug构建类型应用程序依赖于debug库的构建.以下不起作用:
pubReleaseCompile project(path: ':common', configuration: "pubRelease")
devReleaseCompile project(path: ':common', configuration: "devRelease")
pubDebugCompile project(path: ':common', configuration: "pubDebug")
devDebugCompile project(path: ':common', configuration: "devDebug")
Run Code Online (Sandbox Code Playgroud)
注意:库已设置为编译所有变体.
有没有办法根据flavor和build类型指定条件项目依赖?
编辑:为避免混淆,请遵循build.gradle我目前正在使用的项目中的相关文件.
project/common/build.gradle(库)
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.hugo' // annotation-based code generated logs only in debug build
android {
defaultPublishConfig "pubRelease"
publishNonDefault true // four variants of the library are built
buildTypes {
debug …Run Code Online (Sandbox Code Playgroud)