React Native & Expo errors · Error 05 of 12

Android “Duplicate class … found in modules”

By Muhammad Abdullah, full-stack, mobile and ai automation developer · Last reviewed

Execution failed for task ':app:checkReleaseDuplicateClasses'. Duplicate class … found in modules …

Short answer

Two dependencies include the same Java/Kotlin classes. Find which libraries the error names, then update, remove or exclude one of them so only one copy is bundled.

Common causes

  • Two versions of the same library pulled in by different packages.
  • An old library still using pre-AndroidX support libraries alongside AndroidX.
  • A library and its “-ktx” or “-jdk” variant both being included.

How to fix it

  1. Read the two module names in the error message; they tell you which dependencies clash.

  2. Update the React Native libraries that bring them in to versions compatible with your SDK:

                          npx expo install --fix
                        
  3. If the conflict remains, remove the outdated library or exclude the duplicate module in Gradle (in Expo, via a config plugin) and rebuild.

Let’s talk about the next step

Have an idea, a stuck app, or a workflow toimprove?

Tell me what you are building, what is blocking you, and what a successful outcome looks like.