Duplicate class when using BoM

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.1
  • Firebase Component: 25.12.0 BoM
  • Component version: 24.1.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Create a blank project with a simple blank activity, which only contains the following two implementations, and try and build the app in Android Studio.

Results in duplicate class errors such as this:

Duplicate class com.google.android.gms.internal.vision.zze found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)

(jetifier to false makes no difference android.enableJetifier=false)

Relevant Code:

dependencies {
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation "com.google.firebase:firebase-ml-vision"

Full example in this SO post – https://stackoverflow.com/questions/64502154/duplicate-class-in-firebase-common-and-jetified-firebase-components-with-library – Includes debugging information

1 possible answer(s) on “Duplicate class when using BoM