firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

Build time error with external grpc dependencie

Open jaimemensajeros opened this issue 3 years ago • 7 comments

[REQUIRED] Step 2: Build time

  • Android Studio version: Android Studio Flamingo | 2022.2.1 Canary 8 Build #AI-222.4345.14.2221.9252092, built on November 3, 2022 Runtime version: 17.0.4.1+0-17.0.4.1b469.62-9127311 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.0.1 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 8 Metal Rendering is ON Registry: external.system.auto.import.disabled=true ide.text.editor.with.preview.show.floating.toolbar=false gradle.version.catalogs.dynamic.support=true

  • Firebase Component: messaging, perf, crashlytics, analytics

  • Component version: firebase-bom:31.1.0

[REQUIRED] Step 3: when compiling the project with a grpc dependency in another module it generates duplicate class conflicts

Steps to reproduce:

Add grpc library to module app

implementation('io.grpc:grpc-okhttp:1.50.2')
implementation('io.grpc:grpc-stub:1.50.2')
implementation('io.grpc:grpc-protobuf:1.50.2')

and add firebase libraries

implementation platform('com.google.firebase:firebase-bom:31.1.0')

implementation "com.google.firebase:firebase-messaging"
implementation "com.google.firebase:firebase-functions-ktx"
implementation "com.google.firebase:firebase-perf"
implementation "com.google.firebase:firebase-crashlytics"
implementation "com.google.firebase:firebase-analytics"

Relevant Code:

error build

Duplicate class com.google.api.Advice found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.Advice$1 found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.Advice$Builder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AdviceOrBuilder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AnnotationsProto found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthProto found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthProvider found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthProvider$1 found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthProvider$Builder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthProviderOrBuilder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthRequirement found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthRequirement$1 found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthRequirement$Builder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthRequirementOrBuilder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.Authentication found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.Authentication$1 found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.Authentication$Builder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0) Duplicate class com.google.api.AuthenticationOrBuilder found in modules jetified-proto-google-common-protos-2.9.0 (com.google.api.grpc:proto-google-common-protos:2.9.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0)

jaimemensajeros avatar Nov 24 '22 15:11 jaimemensajeros

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Nov 24 '22 15:11 google-oss-bot

Thanks for reporting, @jaimemensajeros. I was able to reproduce the same behavior.

Just adding some notes here. It seems that com.google.firebase:firebase-perf have a duplicate class to the grpc library io.grpc:grpc-protobuf:1.50.2.

argzdev avatar Nov 28 '22 17:11 argzdev

@argzdev If it's firebase-perf, it's the one that has that duplication of the libraries, exactly this library com.google.firebase:protolite-well-known-types:18.0.0

jaimemensajeros avatar Nov 28 '22 17:11 jaimemensajeros

Yes, I'll notify our engineers and see what we can do here. Thanks!

argzdev avatar Nov 28 '22 17:11 argzdev

Hi @jaimemensajeros @argzdev , wondering if you see this issue for other firebase libraries, or just firebase-perf?

linyinlyu avatar Dec 01 '22 22:12 linyinlyu

Any workaround available?

gdesantos avatar Feb 28 '23 12:02 gdesantos

is there any solve issue for this ? facing the same issue right here

IrvanWijayaSardam avatar Sep 12 '24 12:09 IrvanWijayaSardam

Hello. I believe this issue is due to Firebase not supporting Proto 4. Could you try downgrading gRPC to 1.62.2, and make sure any other dependencies do not depend on Proto 4? We have plans to upgrade to Proto 4 in the future but as of now, this is the only workaround

exaby73 avatar Nov 26 '24 15:11 exaby73

Hey @jaimemensajeros. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Dec 11 '24 02:12 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@jaimemensajeros if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Dec 18 '24 02:12 google-oss-bot

Do you have any updates? I'm experiencing a similar issue in the following environment:

implementation("io.grpc:grpc-kotlin-stub:1.4.1") implementation platform('com.google.firebase:firebase-bom:33.7.0') implementation "com.google.firebase:firebase-perf"

kjjeon avatar Jan 15 '25 14:01 kjjeon