Duplicate class Android Origin: On your device Last updated 13 Oct 2026

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.

Exact message you may see Duplicate classfound in modulesDuplicate class kotlin.collections
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.support with 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

  1. Enable Jetifier / migrate to AndroidX
  2. Align Kotlin versions with the Kotlin BOM
  3. Exclude the duplicate module from one dependency
  4. Run ./gradlew app:dependencies to find who brings it in

Detailed fix by platform

Android

  1. 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

  1. Modules — Which two artifacts are named?
  2. Tree — gradlew dependencies — who pulls each in?
  3. 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:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

0x8007007E — 0x8007007E: The specified module could not be found (Windows)0x8007007EAndroid resource linking failed — AAPT: error: resource x (aka y) not found — Android resource linking failed (Android)Android resource link…android:attr/lStar not found — AAPT: error: resource android:attr/lStar not found (Android)android:attr/lStar no…Cannot fit requested classes in a single dex file — Cannot fit requested classes in a single dex file (# methods: 65536 > 65536) — mergeDex failed (Android)Cannot fit requested …ClassNotFoundException — java.lang.ClassNotFoundException / NoClassDefFoundError (Java)ClassNotFoundExceptionComposer conflict — Your requirements could not be resolved to an installable set of packages. (PHP)Composer conflictCould not resolve — Gradle: Could not resolve all files for configuration / Could not resolve dependency (Android)Could not resolveDependency requires compileSdk — Dependency 'androidx.x:1.y' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Android)Dependency requires c…Duplicate…

Explore the map of this error Full error map →

🧠 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.