Cannot fit requested classes in a single dex file 🤖 Android

Cannot fit requested classes in a single dex file (# methods: 65536 > 65536) — mergeDex failed

The app exceeds the 64K method reference limit of a single DEX file and multidex isn’t enabled (minSdk below 21).

Seen on: Android

Meaning

Apps with minSdk 21+ get multidex automatically. With lower minSdk you must enable multidex — or better, raise minSdk and shrink dependencies.

Common causes

  • minSdk < 21 with many dependencies
  • Large libraries pulling many methods
  • Multidex not enabled

⚡ Quick fix

  1. Raise minSdk to 21+ (recommended)
  2. Or enable multiDexEnabled true and add androidx.multidex
  3. Remove unused dependencies / enable R8 shrinking

Detailed fix by platform

Gradle

  1. kotlin
    android {
      defaultConfig {
        minSdk = 21          // multidex native from API 21
        // multiDexEnabled = true  // only if minSdk < 21
      }
    }

How to diagnose

  1. minSdk — Value in build file
  2. Methods — APK Analyzer reference count

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

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