google / java-photoslibrary

Java client library for the Google Photos Library API
http://developers.google.com/photos
Apache License 2.0
108 stars 59 forks source link

Protobuf-java not compatible with Android #22

Open dakdroid opened 5 years ago

dakdroid commented 5 years ago

Most Google libraries use protobuf-lite which isn't compatible with protobuf-java:

AGPBI: {"kind":"error","text":"Program type already present: com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream","sources":[{}],"tool":"R8"}

Libraries e.g.: com.google.android.gms:play-services-cast-framework:17.1.0 com.google.firebase:firebase-config:19.0.2 com.google.android.datatransport:transport-backend-cct:2.0.1

bubbleguuum commented 5 years ago

It's specifically newer versions of firebase-config that cause this problem, because it adds a dependency on com.google.protobuf:protobuf-lite:3.0.1 which is incompatible with protobuf-java used by java-photoslibrary.

A workaround seems to exclude protobuf-lite from remote-config:

implementation ('com.google.firebase:firebase-config:19.0.2') {
        exclude group: 'com.google.protobuf', module:'protobuf-lite'
    }

I have not seen any side-effect on remote-config with this, although this is really band-aid.

benju69 commented 4 years ago

Same issue here with firebase performance with the 1.5.0

bubbleguuum commented 4 years ago

Still a problem to this day.

The workaround I mentioned in second post does not work: it will remove compilation errors caused by the duplicate protobuf classes, but firebase-config will does not work properly (fail to fetch values).

So you cannot use java-photoslibrary in conjunction with any library that needs com.google.protobuf:protobuf-javalite such as some firebase libraries. For remote-config, you can stay with older version 18.0.0, the last version that does not use protobuf-javalite.

Would be nice if a solution was found, for example by making this library compatible with protobuf-javalite.