Duplicate class X found in modules A and B
Two dependencies ship the same class — typically old Android Support libraries mixed with AndroidX, or Kotlin stdlib-jdk7/jdk8 version mixes.
Duplicate classfound in modulesDuplicate class kotlin.collections Meaning
The build merges all classes into one app; the same fully-qualified class in two artifacts is a conflict. The message names both modules, which tells you exactly which dependency to exclude or upgrade.
Common causes
- Mixing
com.android.supportwith AndroidX - Different Kotlin stdlib artifacts (kotlin-stdlib-jdk8 vs kotlin-stdlib) on mismatched versions
- Two libraries bundling the same third-party code (Guava listenablefuture, protobuf-lite vs protobuf-java)
⚡ Quick fix
- Enable Jetifier / migrate to AndroidX
- Align Kotlin versions with the Kotlin BOM
- Exclude the duplicate module from one dependency
- Run
./gradlew app:dependenciesto find who brings it in
Detailed fix by platform
Android
- Align Kotlin and exclude a duplicate:kotlin
dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.9.24")) implementation("com.example:legacy-lib:2.0") { exclude(group = "com.google.guava", module = "listenablefuture") } }
How to diagnose
- Modules — Which two artifacts are named?
- Tree — gradlew dependencies — who pulls each in?
- Versions — Can one upgrade remove the conflict?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Android
- INSTALL_PARSE_FAILED_NO_CERTIFICATES INSTALL_PARSE_FAILED_NO_CERTIFICATES / App not installed as package appears to be invalid
- incompatible version of Kotlin Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.0.0, expected version is 1.8.0
- INSTALL_FAILED_NO_MATCHING_ABIS INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026