Repository: firebase/firebase-android-sdk

Issue #4206: Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found (BoM 31.0.0)
Created: 2022-10-14T22:05:06Z
[READ] Step 1: Are you in the right place?
Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

For general technical questions, post a question on StackOverflow
with the firebase tag.
For general Firebase discussion, use the firebase-talk
google group.
For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized
Firebase support channel.

[REQUIRED] Step 2: Describe your environment

Android Studio version: Dolphin
Firebase Component: Functions, Messaging
Component version: BoM 31.0.0

[REQUIRED] Step 3: Describe the problem
After upgrading to the BoM 31.0.0, I see the following error in the logcat:
Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules
firebase-iid-20.0.1-runtime (com.google.firebase:firebase-iid:20.0.1)
and firebase-messaging-23.1.0-runtime (com.google.firebase:firebase-messaging:23.1.0)

Steps to reproduce:
Add the BoM, firebase-messaging and firebase-functions dependencies:
    implementation platform('com.google.firebase:firebase-bom:31.0.0')

    implementation 'com.google.firebase:firebase-functions'
    implementation 'com.google.firebase:firebase-messaging'
A current workaround is to also define the iid version explicitly:
    implementation platform('com.google.firebase:firebase-bom:31.0.0')

    implementation 'com.google.firebase:firebase-functions'
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-iid:21.1.0'
But it would be nice if the fix was implemented on the SDK itself.

Duplicate issue #4266: Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver bom:31.0.2
Created: 2022-10-31T08:18:31Z
Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver in iid and messaing
I am receiving the below error when trying to build the app
Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules jetified-firebase-iid-20.0.1-runtime (com.google.firebase:firebase-iid:20.0.1) and jetified-firebase-messaging-23.1.0-runtime (com.google.firebase:firebase-messaging:23.1.0)

Android Studio version: Android Studio Dolphin | 2021.3.1 Patch 1Build #AI-213.7172.25.2113.9123335, built on September 30, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 x86_64
Firebase Component: gradle↓
Component version: bom:31.0.2

Cause
This is because there is a uniquely extended FirebaseInstanceIdReceiver in the messaging package.
Is there any way to resolve this issue?

gradle
 //firebase
    implementation platform('com.google.firebase:firebase-bom:31.0.2')
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-auth-ktx'
    implementation 'com.google.firebase:firebase-storage-ktx'
    implementation 'com.google.firebase:firebase-firestore-ktx'
    implementation 'com.google.firebase:firebase-functions-ktx'
    implementation 'com.google.firebase:firebase-messaging-ktx'
    implementation 'com.google.firebase:firebase-inappmessaging-ktx'
    implementation 'com.google.firebase:firebase-inappmessaging-display-ktx'
    implementation 'com.google.firebase:firebase-config-ktx'
gradle.properties
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m

Closing comment (2022-10-31T09:08:32Z): This seems to be a duplicate of #4206. Can you check if the provided workaround works?
That said, I'll close this issue now. Thanks.