Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikeypdev opened this issue Jul 9, 2021 · 17 comments

Comments

@mikeypdev
Copy link

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

@paulinon paulinon removed the new New issue. label Jul 12, 2021
@paulinon
Copy link
Contributor

Hi @mikeypdev,

This seems like a bug related to the dependencies. Could you provide the complete steps you've taken before facing this issue so that we can confirm this?

@paulinon paulinon added the needs-info Need information for the developer label Jul 13, 2021
@mikeypdev
Copy link
Author

mikeypdev commented Jul 19, 2021

Before updating to 8.0.0, I updated from 7.1.0 to 7.2.0 (this was 2 months ago). In the process of updating from 7.1.0 to 7.2.0, I removed the deprecated Google Game Package Registry from UPM, and migrated to local tgz files. I did the upgrade entirely outside of Unity, by manually adding a project-level GooglePackages folder containing the Firebase 7.2.0 and EDM tgz files and then updating Packages/manifest.json to remove the scopedRegistries entry for Google Game Package Repository, and update each Firebase SDK entry to point to the new local tgz files.

I seem to recall trying to remove the InstanceID SDK at the time, and getting some errors. I'm afraid I don't remember the issue, as I decided it was easier to leave the SDK in place. I was able to move forward without further issues.

In the process of updating from 7.2.0 to 8.0.0, I replaced the Firebase and EDM tgz files and manually updated Packages/manifest.json. I then encountered the Instance ID conflict when building for Android. I did not see any conflict or errors for Desktop or iOS builds. At this point, I was not using a custom gradle file for Android builds, so I enabled it in my project settings and EDM settings, did the upgrade from 7.2.0 to 8.0.0 again, and was then able to implement the workaround I noted above.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Jul 19, 2021
@paulinon
Copy link
Contributor

Hi @mikeypdev,

Could you try going to Assets > External Dependency Manager > Android Resolver > Force Resolve and see if the issue persists?

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Jul 22, 2021
@visioncored
Copy link

I am also facing this issue after updating from 7.2.0 to 8.1.0.

Tried doing Force Resolve via Assets > External Dependency Manager > Android Resolver > Force Resolve, but the issue still persists. I realised there is a change in Android Resolver Dependencies xml file.

image
image
image

I had attached the two dependencies files, not sure if it helps.

AndroidResolverDependenciesOld.txt

AndroidResolverDependenciesNew.txt

@thsbrown
Copy link

thsbrown commented Jul 22, 2021

Also facing this issue. Also, @paulinon tried Force resolving with no fix. Seems like another case of dependency hell with firebase & unity 😭 .

Strange thing as far as my project is concerned is that I'm not using InstanceId anywhere in my project 🤔 .

@mikeypdev
Copy link
Author

@paulinon I can confirm that Force Resolve does not fix the issue for me. The workaround that I noted above is still required.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Jul 25, 2021
@paulinon
Copy link
Contributor

paulinon commented Jul 26, 2021

Hi @mikeypdev,

I haven't been able to reproduce your issue on my end so far. Could you try to make use of the quickstart and see if the issue persists there? If it does, please provide the steps you've taken.

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Jul 26, 2021
@AhmadouDiarra
Copy link

Hi all, I'm having the same problem. The only thing I did is upgrading Firebase (Analytics, Auth, Firestore) from 7.0.2 to 8.1.0 and add (database, functions, messaging, storage) at 8.1.0. It's been days I'm looking for fix

@thsbrown
Copy link

thsbrown commented Jul 26, 2021 via email

@adityathoutam
Copy link

Upgrading from 7.2.0 to 8.1.0. Got the same issue

@Jack37
Copy link

Jack37 commented Jul 29, 2021

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

@kashif789us
Copy link

This was introduced in version 8.0.0 and I am amazed Firebase released 8.1.0 without fixing it. It only gets produced when you are using Messaging SDK.

@kashif789us
Copy link

kashif789us commented 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

@mikeypdev
Copy link
Author

Replying in order to flip the Needs Info status. I have not yet had a chance to repro in the Quickstart project, but @Jack37 seems to have a simple repro case.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Aug 2, 2021
@licexicel
Copy link

Also facing this, same as Jack37 above.
Pretty sure that was cause by Firebase Functions and Firebase Messaging coexist.
Happened when I try to add Firebase Functions to my current project with Messaging already exist.
Testing on Firebase SDKs:7.2.0 & 8.1.0, both happened.

Also reproduce under a blank project
Unity version: 2020.3.15f2
External Dependency Manager version: 1.2.166
Firebase SDKs installed: Functions, Messaging (8.1.0, dotnet4)
MultiDex enabled, building on Android using Mono

@DellaBitta
Copy link
Contributor

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!

@DellaBitta DellaBitta added this to the 8.2.0 milestone Aug 11, 2021
@YongjinK
Copy link

YongjinK commented Aug 13, 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!

With 8.0.0, this fix does not work. The resolver ignores MessagingDependencies.xml and adds firebase-iid:20.0.01 rather than 21.1.0.

I cannot believe that the team didn't even try to build a blank Firebase project before world-wide public distribution. Firebase-unity 8 should better be 8-alpha if things keep going this way.

@firebase firebase locked and limited conversation to collaborators Sep 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests