Skip to content

Mobile Payments SDK Android: Consider switching to protobuf-javalite #13

@lemz90

Description

@lemz90

We're encountering dependency conflicts in our Flutter Android application between the Square Mobile Payments SDK (which uses full protobuf) and Firebase Firestore (which uses protobuf-javalite). This is causing duplicate class definition errors for com.google.protobuf classes.

Current Situation

  • Our app uses a recent version of Firebase and Square Mobile Payments SDK 2.1.0
  • Android Mobile Payments SDK uses protobuf-java:3.25.3 both directly and through retrofit2:converter-protobuf:2.11.0
  • Firebase and other Google libraries use protobuf-javalite:3.25.1
  • These cannot coexist in the same app due to duplicate class definitions

Why protobuf-lite?

  1. Google officially recommends protobuf-javalite for Android applications:

    "For Android users, it's recommended to use protobuf Java Lite runtime because of its smaller code size. Java Lite runtime also works better with Proguard because it doesn't rely on Java reflection and is optimized to allow as much code stripping as possible."

  1. Firebase, being one of the most widely used mobile SDKs, has standardized on protobuf-javalite.

Request

Could you consider switching to protobuf-javalite in a future release? This would:

  • Resolve compatibility issues with Firebase and other Android libraries
  • Reduce the SDK's footprint in apps

Workarounds Attempted

  • Forcing protobuf-javalite usage through Gradle results in runtime crashes due to missing GeneratedMessageV3 class
  • Excluding protobuf-java from the Square SDK dependency breaks functionality
  • Downgrading Firebase is not feasible due to security and feature requirements

Thank you for considering this request. We understand this might require significant changes, but it would greatly improve the SDK's compatibility with the broader Android ecosystem. If there is some workaround I'm not aware of, I'd love to see it!

forum post

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions