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.
Seen on:
Android
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026