Skip to content
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

Duplicate class caused by proto libraries clash when using both Firebase Performance Monitoring and Stripe SDK #135

Closed
Milszym opened this issue May 12, 2021 · 6 comments

Comments

@Milszym
Copy link

Milszym commented May 12, 2021

Summary

I am encountering Duplicate class gradle issue during :app:checkDebugDuplicateClasses and :app:mergeDebugJavaResource gradle tasks when using the Firebase Performance Monitoring library. It's caused by the clash of these two transitive dependencies.

  • com.google.firebase:protolite-well-known-types:17.1.1 - existing in com.google.firebase:firebase-perf-ktx dependency
  • com.google.protobuf:protobuf-java-util:3.11.4 - used by Stripe Terminal Beta SDK com.stripe:stripeterminal:2.0.0-b3
    Both libraries contains same classes like e.g.: class com.google.protobuf.AbstractMessageLite

A part of task failure message:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.google.protobuf.AbstractMessageLite found in modules jetified-protobuf-java-3.11.4 (com.google.protobuf:protobuf-java:3.11.4) and jetified-protobuf-javalite-3.14.0 (com.google.protobuf:protobuf-javalite:3.14.0)
...
[SOME MORE DUPLICATE CLASS LOGS]
...
     Duplicate class com.google.protobuf.Writer$FieldOrder found in modules jetified-protobuf-java-3.11.4 (com.google.protobuf:protobuf-java:3.11.4) and jetified-protobuf-javalite-3.14.0 (com.google.protobuf:protobuf-javalite:3.14.0)

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'google/protobuf/field_mask.proto'.

Part of the dependency tree generated after running :app:dependencies gradle task:

Stripe
+--- com.google.protobuf:protobuf-java-util:3.11.4
     |    +--- com.google.protobuf:protobuf-java:3.11.4
Firebase Performance Monitoring
+--- com.google.firebase:protolite-well-known-types:17.1.1
|    |    |    \--- com.google.protobuf:protobuf-javalite:3.14.0
|    |    +--- com.google.protobuf:protobuf-javalite:3.14.0

How can I approach this issue? I would like to use both Stripe and Firebase Performance Monitoring. I also don't want to exclude any of these protobuf dependencies, since it can cause some unpredictable runtime crashes, because of the lack of dependencies. Do you have any solution for this matter?

Code to reproduce

Here is a minimal repository to reproduce the issue:
https://github.com/Milszym/AndroidProtobufConflict
Please just build and run the project to see the failure which I have described above.

Android version

SDK 24+ (7.0+)

Impacted devices (Android devices or readers)

All devices - it's happening during gradle task

SDK version

2.0.0-b3

@sgaw-stripe
Copy link
Contributor

Thanks for the feedback and the example!

We know it's frustrating for all of the folks that are using Firebase.  There's a project we've been working on to work around this issue Dan filed:

protocolbuffers/protobuf#8104

We don't have an ETA for the fix yet as the scope of the fix has taken a few months and there's quite a bit left to do, but we'll update the ticket when a fix is out.

@billfinn-stripe billfinn-stripe pinned this issue Jun 22, 2021
@bkinter
Copy link

bkinter commented Aug 18, 2021

Any work on this? The above linked issues was closed a few weeks ago, and the exclusion solution it describes is not working.

@dhenry-stripe
Copy link
Contributor

Appreciate your patience on this @bkinter. A fix will be available in our next release; currently scheduled for early next week.

@dhenry-stripe
Copy link
Contributor

@billfinn-stripe billfinn-stripe unpinned this issue Aug 31, 2021
@filipatbnp
Copy link

all right, but what actually was fixed and where?

@chr-stripe
Copy link
Collaborator

Hi @filipatbnp, this particular issue has been resolved a while ago. If you're seeing a similar problem related to this, feel free to file a new issue describing what behaviour you're seeing and we'd be happy to look into it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants