This message was deleted.
# android
s
This message was deleted.
n
Can you visualize the variant information on the library using the
outgoingVariants
task?
n
Yeah it’s this one:
I’d like for them to use the dependency with the attribute
com.android.build.api.attributes.BuildTypeAttr
set to
release
but only for a given library (i.e. I don’t want to apply this for the whole
implementation
configuration)
s
I think this is feasible by explicitly setting the attributes/capability for the dependency in question. Something like
Copy code
implementation(libs.foo) {
        attributes {
            attribute(BuildTypeAttr.ATTRIBUTE, project.objects.named(BuildTypeAttr::class.java, "release"))
        }
    }
I don't remember the exact syntax here, but I had tried this out a while back to see if it was possible and remember that this had worked (based on the output of dependencyInsight)
n
Oh thanks for sharing 👀
j
Yes. The
configuration: ...
notation is kind of outdated and might be deprecated soon (I assume...). Doing something like @Satyarth Sampath suggest (using
attributes { ... }
) would be the "correct" way to do it nowadays.
👍 1
n
Thank you all for the support 👍 That worked well. It’s a shame this is not documented anywhere 😞 I expected to find it either here: https://docs.gradle.org/current/userguide/variant_model.html or here https://docs.gradle.org/current/userguide/variant_attributes.html