Gradle fail: Duplicate class com.google.firebase.ktx.Firebase
Asked Answered
M

0

4

After upgrading from 2021.3.16f1 LTS to 2022.3.10f1 LTS we get the following error when building our APK:

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.google.firebase.ktx.Firebase found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)
     Duplicate class com.google.firebase.ktx.FirebaseCommonKtxRegistrar found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)
     Duplicate class com.google.firebase.ktx.FirebaseCommonKtxRegistrar$getComponents$$inlined$coroutineDispatcher$1 found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)
     Duplicate class com.google.firebase.ktx.FirebaseCommonKtxRegistrar$getComponents$$inlined$coroutineDispatcher$2 found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)
     Duplicate class com.google.firebase.ktx.FirebaseCommonKtxRegistrar$getComponents$$inlined$coroutineDispatcher$3 found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)
     Duplicate class com.google.firebase.ktx.FirebaseCommonKtxRegistrar$getComponents$$inlined$coroutineDispatcher$4 found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)
     Duplicate class com.google.firebase.ktx.FirebaseKt found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)
     Duplicate class com.google.firebase.ktx.FirebaseKt$coroutineDispatcher$1 found in modules jetified-com.google.firebase.firebase-common-20.4.0-runtime (:com.google.firebase.firebase-common-20.4.0:) and jetified-com.google.firebase.firebase-common-ktx-20.3.3-runtime (:com.google.firebase.firebase-common-ktx-20.3.3:)

We have tried deleting and upgrading firebase after deleting the Unity Library folder.

Metamorphism answered 20/12, 2023 at 9:12 Comment(5)

I ran into the same issue. Apparently this probably doesn't have to do with the change to the newer Unity version but that there is a new firebase package (20.4.0) which was released on September 28: https://mvnrepository.com/artifact/com.google.firebase/firebase-common/20.4.0 So you probably have some references to 20.3.3 in some packages as well which is the cause for those dependency conflicts.

Gand

Same error here

Sodality

I'm having the same error, no solution yet

Niphablepsia

Any idea how to figure out what the 20.3.3 files are? Do we just have to delete all of our plugins and reinstall everything?

Metamorphism

I'm working on it. Also having some talented guys in background who look into that as well. When I find a solution I'm going to post it here. But it might differ from project to project ofc.

Gand

© 2022 - 2024 — McMap. All rights reserved.