tony
09/30/2026, 9:09 PMAttributeDisambiguationRule. I'm getting an illegal argument exception:
Unable to determine constructor argument #1: missing parameter of type ObjectFactory, or no service of type ObjectFactory.
(note in case anyone wonders: this is the org.gradle.api.model.ObjectFactory)
Here's a simplified version that includes just the relevant details:
// plugin class
attribute(BuildTypeAttr.ATTRIBUTE).run {
disambiguationRules.add(AndroidBuildTypeDisambiguationRule::class.java)
}
// separate class
abstract class AndroidBuildTypeDisambiguationRule @Inject constructor(
private val objects: ObjectFactory,
) : AttributeDisambiguationRule<BuildTypeAttr> {
override fun execute(details: MultipleCandidatesDetails<BuildTy
val release = objects.named(BuildTypeAttr::class.java, "release")
}
}
When I run this, it fails with:
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':platform:generateMetadataFileForPlatformPublication' (registered by plugin 'org.gradle.maven-publish').
> Could not resolve project ':producer-android'.
> Could not select value from candidates [debug, release] using AndroidBuildTypeDisambiguationRule.
> Could not create an instance of type com.autonomousapps.platformbuilder.internal.utils.attributes.AndroidBuildTypeDisambiguationRule.
> Unable to determine constructor argument #1: missing parameter of type ObjectFactory, or no service of type ObjectFactory.
My code looks like an exact replicate of the example in the Gradle docs here. What am I doing wrong?