0

I am totally new to android studio. I am trying to read some text using Firebase-ML, but I am getting duplicate class error when I try to run the program

Error:

Duplicate class com.google.android.gms.internal.vision.zzu found in modules jetified-play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and jetified-play-services-vision-image-labeling-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-image-labeling-internal:16.0.0)

Here are my Gradle dependencies.

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    implementation platform('com.google.firebase:firebase-bom:26.3.0')

    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.android.gms:play-services-auth:19.0.0'

    implementation 'com.google.android.gms:play-services-vision:20.1.3'

    implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
    implementation 'com.google.firebase:firebase-ml-vision-image-label-model:20.0.2'
    implementation 'com.google.android.material:material:1.2.1'

}

I don't know what to do here?

1 Answers1

0

I think this might be the same I ran into when adding another Google API. Try adding the following to your build.gradle:

    android {
    .
    .
    .
        // Firebase uses a smaller proto but other Google APIs uses the full system so I need to exclude the
        //  light libraries when using Google APIs with Firebase and then Firebase will use the
        //  full library
        configurations {
            implementation.exclude module: 'protobuf-lite'
        }
Kenneth Argo
  • 1,697
  • 12
  • 19