googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.59k stars 2.94k forks source link

[Bug report] Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules jetified-firebase-iid-20.1.5-runtime and jetified-firebase-messaging-24.0.3-runtime #887

Open qc-kgm opened 1 month ago

qc-kgm commented 1 month ago

I encountered a duplicate class error after importing the following dependency:

implementation 'com.google.mlkit:linkfirebase:17.0.0'

I am using the following environment:

Firebase BOM version: 33.5 Firebase Messaging version: 24.0.3 Purpose of using com.google.mlkit:linkfirebase: I am working on a custom image labeling model using TensorFlow, following the ML Kit guidelines from Google. After adding com.google.mlkit:linkfirebase, the following error occurred:

Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules jetified-firebase-iid-20.1.5-runtime (com.google.firebase:firebase-iid:20.1.5) and jetified-firebase-messaging-24.0.3-runtime (com.google.firebase:firebase-messaging:24.0.3)

Question:

I noticed that the last update to the linkfirebase API in the ML Kit release notes was on 01/25/2022. Is there any workaround to resolve this issue immediately? Additionally, if the root cause of this error is related to the outdated com.google.mlkit:linkfirebase library, I would like to suggest updating this library to resolve compatibility issues with the latest versions of Firebase dependencies.

Thank you very much!

SDK Info:

Smartphone: n/a

Development Environment: n/a

SilverDestiny commented 3 weeks ago

Thanks for reporting the issue! We'll update com.google.mlkit:linkfirebase later to fix this issue.

In the meantime, I think you can workaround your project by adding implementation("com.google.firebase:firebase-iid:21.1.0") to your dependency. Thanks!

qc-kgm commented 3 weeks ago

Thank you for your solution, but I have switched to using com.google.firebase:firebase-ml-modeldownloader following a newer guide from Google. It worked, so if anyone encounters the same issue, they can refer to this solution.