Duplicate Class In Protobuf Lite And Protobuf Java
Solution 1:
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.
Solution 2:
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.
Solution 3:
In my case this happened because of mixed package dependencies specifically barcode_scan
This error means that you are importing two packages that use Protobuf for your project, one of them has a distribution that's conflicting with the other.
If you encountered this problem on Flutter, you can reconsider the version number of your dependencies in pubspec.yaml, and replace "any" by an exact version number. For example, under "dependencies:" change:
barcode_scan: anyTo:barcode_scan: ^2.0.0
I hope I helped.
Post a Comment for "Duplicate Class In Protobuf Lite And Protobuf Java"