Android "Duplicate class" in CI
Two dependencies bring the same class onto the classpath, so the Android build cannot decide which to use. Usually an old and a new artifact of the same library (or a renamed module) coexist.
What this error means
The build fails with "Duplicate class <name> found in modules ... and ...", naming two artifacts that both contain the class. It is deterministic and tied to your dependency graph.
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules
kotlin-stdlib-1.8.0 and kotlin-stdlib-jdk8-1.6.0
Go to the documentation to learn how to <a>resolve dependency conflicts</a>.Common causes
Two artifacts contain the same class
A library was split or renamed across versions (e.g. kotlin-stdlib-jdk8 merged into kotlin-stdlib), and both end up on the classpath.
Transitive version drift
Different dependencies pull different versions of a shared library, and the merged classpath contains duplicate classes.
How to fix it
Align versions with a BOM / platform
A platform constraint keeps related artifacts on one consistent version so duplicates disappear.
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.0.20"))
// related kotlin artifacts now share one version
}Exclude the redundant artifact
When one artifact is obsolete, exclude it from the dependency that drags it in.
implementation("com.example:lib:1.0") {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
}How to prevent it
- Use a BOM/platform to keep related artifacts on one version.
- Run
./gradlew :app:dependenciesto spot duplicate sources. - Avoid mixing split/renamed artifact variants of the same library.