question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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)

See original GitHub issue

[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.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
DellaBittacommented, Aug 11, 2021

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!

3reactions
kashif789uscommented, Jul 29, 2021

[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

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase - Duplicate class com.google.android.gms.internal ...
So, gradle upload the latest com.google.firebase:firebase-messaging:22.x.x which declare already existing classes in firebase-iid.
Read more >
Build Error on Android [checkReleaseDuplicateClasses]
Hello,I am getting error while building my app for android, I can successfully build it for iOS. Here my error Log
Read more >
Firebase Android SDK Release Notes - Google
Cloud Messaging, com.google.firebase:firebase-messaging-ktx, 23.2.1 ... Fixed a bug where apps that target Android API 33+ and run on Android version 13+ ...
Read more >
Release Notes - Play services
The latest update to the play-services-tagmanager library improves internal tooling processes. No developer-facing changes. Artifacts released on maven.google.
Read more >
"Duplicate class found" error if play-services-ads:21.2.0 is used
Hi, When I try to compile after adding this plugin on Android I get an error,… `duplicated class com.google.android.gms.internal.measurement.xxx ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found