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 throughretrofit2: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
To be clear this would affect all Android apps attempting to use a recent version of Firebase & Square Mobile Payments SDK, not just Flutter apps.
Why protobuf-lite?
- 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.”
- Source: Official Protobuf Documentation
- 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!