Boolean dependency attribute problems in Kotlin DSL

In a build.gradle.kts, I have the following:

dependencies {
	implementation("my-group", "my-name", "0.1") {
		attributes {
			attribute(Attribute.of("attribute-name", Boolean::class.java), true)
		}
	}
}

Which produces the following error when building with Gradle 5.5.1:

Unexpected type for attribute 'attribute-name'. Expected boolean but was:java.lang.Boolean

How can I fix this?

1 Like

I’m having the same problem, did you find a solution in the end?

Sorry, I didn’t find a solution.

I didn’t look much for one as I wound up not using attributes.

Good luck.

I’ve just seen SO answer recommending to replace of “Boolean::class.java” by “Boolean::class.javaObjectType”

1 Like