ARTICLE AD BOX
I’m hitting a build failure only when running Android instrumented tests (connectedDebugAndroidTest) on a multi-module Android project.
Environment
Android Gradle Plugin: 8.9.0
Gradle: 8.11.1
JDK: 17
Kotlin: 2.2.21
KSP: (tested multiple versions, including matching line 2.2.21-2.0.x)
Module where it fails: :core:database (Android library)
What I’m doing
Running instrumented tests:
Failure
The build fails at:
And D8 reports a duplicate class inside gradle-api-8.11.1.jar:
Type org.gradle.internal.impldep.com.fasterxml.jackson.core.io.doubleparser.BigSignificand is defined multiple times: .../gradle-api-8.11.1.jar:org/gradle/internal/impldep/com/fasterxml/jackson/core/io/doubleparser/BigSignificand.class, .../gradle-api-8.11.1.jar:org/gradle/internal/impldep/META-INF/versions/11/com/fasterxml/jackson/core/io/doubleparser/BigSignificand.classThe jar path is:
~/.gradle/caches/8.11.1/generated-gradle-jars/gradle-api-8.11.1.jar
This looks like D8 treating the Multi-Release JAR entries (META-INF/versions/11/...) as duplicates.
Question
Why is gradle-api-8.11.1.jar ending up on the androidTest classpath / file dependencies for dexing?
What is the correct way to prevent Gradle internal jars (gradle-api) from being included in Android instrumented test dexing?
Is this a known issue/compatibility problem with D8/Desugar and Multi-Release JARs, or likely a misconfiguration in my build?
Notes / What I tried
dependencyInsight --dependency gradle-api on debugAndroidTestRuntimeClasspath did not show a Maven dependency, which makes me suspect a file-based inclusion / plugin/build-logic misconfiguration.
I previously had a build-logic convention module accidentally created as an Android library, but I’ve migrated it back to a JVM Gradle plugin. Still, the error persists only on androidTest dexing.
If anyone has seen this before or knows where to look for the source of gradle-api being pulled into D8, I’d appreciate guidance.
