Skip to content

protobuf-java and protobuf-javalite conflict #8104

@danwaters-stripe

Description

@danwaters-stripe

What version of protobuf and what language are you using?
Version: v3.11.4
Language: Java

What operating system (Linux, Windows, ...) and version?
Mac OS 10.15.7

What did you do?
Including both protobuf-java and protobuf-javalite causes duplicate class errors on build. The simplest reproduction is to just include both as dependencies:

implementation "com.google.protobuf:protobuf-javalite:3.11.0"
implementation "com.google.protobuf:protobuf-java:3.11.4"

This will generate these errors on build:

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.11.0 (com.google.protobuf:protobuf-javalite:3.11.0)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules jetified-protobuf-java-3.11.4 (com.google.protobuf:protobuf-java:3.11.4) and jetified-protobuf-javalite-3.11.0 (com.google.protobuf:protobuf-javalite:3.11.0)
...

Even more concerning to me is that you get the same errors even when you just include dependencies on libraries that use these two different libraries. Like firebase:

implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation "com.google.firebase:firebase-firestore"
implementation "com.google.protobuf:protobuf-java:3.11.4"

Since we publish a library that has a dependency on protobuf-java, this means that our library will always conflict with any library that uses protobuf-javalite.

Metadata

Metadata

Assignees

No one assigned

    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