Android studio gradle error

I hope some help me with Gradle dependency isolation between modules in Android studio.
Brief. currently, I’m building an android app that has two modules, app module and another module called “Jumble”, app module rely on the Jumble module, the problem that the Jumble module depends on dependencies that conflict with app module dependencies which leads to “Duplicate class” Gradle error.

In the Jumble module, I’m using protobuf-java library and in the app module I’m using FirebaseFirestore that includes internally a protobuf-lite library and this cause duplicate class error.

NOTE: Jumble module can’t use the lite version of protobuf to unify with the Firebase protobuf-lite version because Jumble module has more advanced code that needs the protobuf-java full version.

To fix this I used keyword “implementation” instead of “api” in Jumble module to make “protobuf-java” lib private for this module only and prevent sharing it with the app module but unfortunately after rebuild fails and Gradle still shows that this library duplicate with the app module Firestore lib

I tried another approach, in the app module, I added exclude rule, rebuild succeed and the app starts but at some point the Jumble module code crash because with “NoSuchMethodException” which means that “protobuf-java” is not compiled and excluded from Jumble module too.

implementation(project(":Jumble")) {

    exclude group: 'com.google.protobuf', module: 'protobuf-java'

}

Here is the duplicate error that Gradle display

Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) 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.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) 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.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractParser found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractProtobufList found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.Any found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Any$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Any$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.AnyProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Api found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Api$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Api$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.ApiOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.ApiProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BoolValue found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BoolValue$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BoolValue$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BoolValueOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BooleanArrayList found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteBufferWriter found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteOutput found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$1 found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$ArraysByteArrayCopier found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$BoundedByteString found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$ByteArrayCopier found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$ByteIterator found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$CodedBuilder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$LeafByteString found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$LiteralByteString found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$Output found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$SystemByteArrayCopier found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.BytesValue found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BytesValue$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BytesValue$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.BytesValueOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.CodedInputStream found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedInputStream$RefillCallback found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedInputStream$SkippedDataSink found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$1 found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$ArrayEncoder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$ByteOutputEncoder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$NioEncoder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$NioHeapEncoder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$OutOfSpaceException found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$OutputStreamEncoder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.DescriptorProtos found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRangeOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRange found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRange$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRangeOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$DescriptorProtoOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProto$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumDescriptorProtoOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptions$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumOptionsOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueDescriptorProtoOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueOptions found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueOptions$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$EnumValueOptionsOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldDescriptorProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Label found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Label$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Type found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Type$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldDescriptorProtoOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldOptions found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldOptions$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldOptions$JSType found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldOptions$JSType$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FieldOptionsOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileDescriptorProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileDescriptorProto$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileDescriptorProtoOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileDescriptorSet found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileDescriptorSet$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileDescriptorSetOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileOptions found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileOptions$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileOptions$OptimizeMode found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileOptions$OptimizeMode$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$FileOptionsOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$GeneratedCodeInfo found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$AnnotationOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$GeneratedCodeInfoOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$MessageOptions found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$MessageOptions$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$MessageOptionsOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$MethodDescriptorProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$MethodDescriptorProto$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$MethodDescriptorProtoOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.DescriptorProtos$MethodOptions found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)(com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.SmallSortedMap$EmptySet$2 found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Go to the documentation to learn how to Fix dependency resolution errors.

app module Gradle file

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.app.demo"
    minSdkVersion 21
    targetSdkVersion 28
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    kapt {
        arguments {
            arg("room.schemaLocation", "$projectDir/schemas".toString())
        }
    }

}


lintOptions {
    abortOnError false
}

buildTypes {
    release {
        shrinkResources false
        minifyEnabled false
        signingConfig signingConfigs.publicVerReleaseSigningKey
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

configurations {
    cleanedAnnotations
    compile.exclude group: 'org.jetbrains', module: 'annotations'

}
}

 dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

//
//implementation 'androidx:multidex:2.0.1'

//
implementation(project(":Jumble")) 


implementation 'org.jsoup:jsoup:1.7.2'
implementation 'info.guardianproject.netcipher:netcipher:1.2'

//
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-database:18.0.0'
//implementation 'com.google.firebase:firebase-firestore:18.0.0'

}
apply plugin: 'com.google.gms.google-services'

Jumble module gradle dependencies

dependencies {

implementation 'com.google.protobuf:protobuf-java:3.0.0'
api 'com.madgag.spongycastle:core:1.51.0.0'

// Custom PKCS12 keybag parse modifications to support Mumble unencrypted certificates
// Source: https://github.com/Morlunk/spongycastle/tree/pkcs12-keybag-fixes
api files('libs/sc-morlunk-prov-1.51.0.0.jar', 'libs/sc-morlunk-pkix-1.51.0.0.jar')

implementation 'com.googlecode.javacpp:javacpp:0.7'
api 'com.intellij:annotations:+@jar'
}

Application gradle file

buildscript {
ext.kotlin_version = '1.3.21'

repositories {
    mavenCentral()
    google()
    jcenter()
    maven {
        url 'https://maven.fabric.io/public'
    }

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.2.0'
    classpath 'io.fabric.tools:gradle:1.29.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    mavenCentral()
    google()
    jcenter()

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}