quickstart-unity: [Bug] Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-20.0.1-runtime.jar (com.google.firebase:firebase-iid:20.0.1) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.6f1
  • Firebase Unity SDK version: 8.0.0
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: InstanceID
  • Other Firebase Components in use: Analytics, Auth, Crashlytics, Database, DynamicLinks, Functions, Messagin, RemoteConfig, Storage
  • Additional SDKs you are using: Unity IAP
  • Platform you are using the Unity editor on: Mac
  • Platform you are targeting: Android, iOS
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

Firebase Instance ID is deprecated, and I was not using it, so I removed the Instance ID SDK from my project when updating to SDK 8.0.0. In SDK 7.2.0, Instance ID implemented firebase-iid:21.1.0 on Android, as seen in mainTemplate.gradle. After removing Instance ID, and upgrading all other Firebase components to 8.0.0, there are no references to firebase-iid in mainTemplate.gradle or AndroidResolverDependecies.xml, as expected.

However, when building to Android, the gradle build fails with the following error: Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-20.0.1-runtime.jar (com.google.firebase:firebase-iid:20.0.1) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0) I do not know where the reference to firebase-iid:20.0.1 is coming from.

As a workaround, I am able to solve the build error by manually adding a reference to firebase-iid:21.1.0 to my mainTemplate.gradle file: implementation 'com.google.firebase:firebase-iid:21.1.0'

This is reproducible 100% of the time in my project, on two different development systems. I have not yet had the bandwidth to repro in any Quickstart example.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Hi all,

We have a fix for this issue that should be in our next release v.8.2.0.

In the meantime, if you would like try to use 8.0.0 or 8.1.0 then you can attempt to manually apply the fix locally.

In Assets/Firebase/Editor/MessagingDependencies.xml add the following to the list of android packages:

<androidpackages>
 ...
   <androidPackage spec="com.google.firebase:firebase-iid:21.1.0"></androidPackage>
 ...
</androidpackages>

Then re-run the Android resolver.

Note that we have not thoroughly tested this with 8.0.0 or 8.1.0, so it would be an experimental and unsupported local change. Still, it should unblock you from using v8+.

I’m going to close this issue for now, but if you continue to encounter this problem after 8.2.0’s release, then please reopen it so that we can investigate it further. Thank you!

[REQUIRED] Please fill in the following fields:

* Unity editor version: 2020.3.6f1

* Firebase Unity SDK version: 8.0.0

* Source you installed the SDK: Unity Package Manager

* Problematic Firebase Component: InstanceID

* Other Firebase Components in use: Analytics, Auth, Crashlytics, Database, DynamicLinks, Functions, Messagin, RemoteConfig, Storage

* Additional SDKs you are using: Unity IAP

* Platform you are using the Unity editor on: Mac

* Platform you are targeting: Android, iOS

* Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

Firebase Instance ID is deprecated, and I was not using it, so I removed the Instance ID SDK from my project when updating to SDK 8.0.0. In SDK 7.2.0, Instance ID implemented firebase-iid:21.1.0 on Android, as seen in mainTemplate.gradle. After removing Instance ID, and upgrading all other Firebase components to 8.0.0, there are no references to firebase-iid in mainTemplate.gradle or AndroidResolverDependecies.xml, as expected.

However, when building to Android, the gradle build fails with the following error: Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-20.0.1-runtime.jar (com.google.firebase:firebase-iid:20.0.1) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0) I do not know where the reference to firebase-iid:20.0.1 is coming from.

As a workaround, I am able to solve the build error by manually adding a reference to firebase-iid:21.1.0 to my mainTemplate.gradle file: implementation 'com.google.firebase:firebase-iid:21.1.0'

This is reproducible 100% of the time in my project, on two different development systems. I have not yet had the bandwidth to repro in any Quickstart example.

Workaround works. It would be better to include a dependency xml file in the project and then force resolve it. It will auto add it to the mainTemplate.gradle. KTDependencies.xml.zip

I can reproduce this in a blank project just with the Firebase Functions and Firebase Messaging installed.

Unity version: 2020.3.15f1 External Dependency Manager version: 1.2.166 Firebase SDKs installed: Functions, Messaging (8.1.0, dotnet4) MultiDex enabled, building on Android using Mono

Gradle error:

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzb found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzc found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzd found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zze found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzf found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzh found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzm found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzo found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzp found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzq found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzr found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.android.gms.internal.firebase_messaging.zzs found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)
  Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules com.google.firebase.firebase-iid-20.0.1-runtime.jar (:com.google.firebase.firebase-iid-20.0.1:) and com.google.firebase.firebase-messaging-22.0.0-runtime.jar (:com.google.firebase.firebase-messaging-22.0.0:)