In case anyone still would be running into this (or similar) issue nowadays, you would want to use matchingFallbacks
to specify which resolved buildType or flavour to fallback to in case the library you depend on does not have matching configurations.
https://developer.android.com/studio/build/build-variants#resolve_matching_errors
By default though there should be a debug
and release
profile so to fix the OP question you would just need to remove the explicit configuration setting in the dependency declaration:
// forces release configuration on library
compile project(path:':library', configuration:'release')
// Allows gradle to match buildType from library to
// what the current module's buildType is:
compile project(path:':library')
Snippets from the dev site in case it moves in the future (.kts):
// In the app's build.gradle file.
android {
defaultConfig {
// Do not configure matchingFallbacks in the defaultConfig block.
// Instead, you must specify fallbacks for a given product flavor in the
// productFlavors block, as shown below.
}
buildTypes {
getByName("debug") {}
getByName("release") {}
create("staging") {
// Specifies a sorted list of fallback build types that the
// plugin should try to use when a dependency does not include a
// "staging" build type. You may specify as many fallbacks as you
// like, and the plugin selects the first build type that's
// available in the dependency.
matchingFallbacks += listOf("debug", "qa", "release")
}
}
flavorDimensions += "tier"
productFlavors {
create("paid") {
dimension = "tier"
// Because the dependency already includes a "paid" flavor in its
// "tier" dimension, you don't need to provide a list of fallbacks
// for the "paid" flavor.
}
create("free") {
dimension = "tier"
// Specifies a sorted list of fallback flavors that the plugin
// should try to use when a dependency's matching dimension does
// not include a "free" flavor. You may specify as many
// fallbacks as you like, and the plugin selects the first flavor
// that's available in the dependency's "tier" dimension.
matchingFallbacks += listOf("demo", "trial")
}
}
}