Duplicate class in protobuf lite and protobuf java

It happened to me because I added this dependency:

implementation 'com.google.firebase:firebase-firestore-ktx:21.5.0'

There was a problem with the latest version of firestore. Use version 21.4.2 instead of 21.5.0 as of August 2020.


The missing classes is a known issue. Full proto and lite proto can't be mixed; they use different generated code. Do not depend on protobuf-java as an implementation dependency, but as a protobuf dependency which will cause gradle-protobuf-plugin to generate code for the .protos.

dependencies {
  ...
  protobuf 'com.google.protobuf:protobuf-java:3.7.1'
}

Note that this solution only really works for an application. If you are a library, it is dangerous because users of your library may then see multiple copied of the generated code for the well-known protos.