Multiple dependencies has similar named class and I'm getting duplicate class errors. To solve I think excluding those parts may help. How to exclude these parts?
Errors +lots of similar lines:
Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-java-3.7.1.jar (com.google.protobuf:protobuf-java:3.7.1) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules protobuf-java-3.7.1.jar (com.google.protobuf:protobuf-java:3.7.1) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules protobuf-java-3.7.1.jar (com.google.protobuf:protobuf-java:3.7.1) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Dependencies:
// gRPC
implementation "io.grpc:grpc-okhttp:$grpcVersion"
implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
implementation "io.grpc:grpc-stub:$grpcVersion"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
//protobuf 'com.google.protobuf:protobuf-java:3.8.0'//error persist with this and without this
// OAuth2 for Google API
implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
exclude module: 'httpclient'
}
//Translation
implementation "com.google.cloud:google-cloud-translate:$grpcVersion"
implementation('com.google.cloud:google-cloud-translate:1.79.0') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'org.json', module: 'json'
//I want to exclude error classes here...HOW?...
//exclude group: 'com.google.protobuf', module: 'protobuf-java-3.7.1'
}
annotationProcessor "com.google.cloud:google-cloud-translate:$grpcVersion"
grpc version on ext:
grpcVersion = '1.4.0'
these are not related to support library versions as these are because of translation and protobuf-lite libraries. these are using different versions of those class and I dont know if excluding of them will work or not.
Is it possible to extract those libraries and change those class names? I want to see if excluding those classes can solve it. How to exclude?