Hello. I need some help with android gradle plugin and variant matching.
I have two projects with android library plugin, lets say :small and :big. I need to embed aar generated by :small into :big - for that there is a custom embed
configuration in :big. For now I can only embed release version of :small, by writing dependencies.embed(project(path: ":small", configuration: "default"))
. But I also need debug version of :small. For that I added two custom configurations to :small - debugEmbedElements
and releaseEmbedElements
, both having same attribute of type Bundling
and different attributes of type BuildTypeAttr
(“debug” and “release”). The problem is if I write dependencies.embed(project(":small"))
, then Gradle “Cannot choose between the following variants of project”. But if I explicitly set embed
configuration to have attribute of type BuildTypeAttr
= “debug”, then everything works as expected. The question is - how to set BuildTypeAttr
to embed configuration dependending on what variant of :big is being built (assembleDebug or assembleRelease)?