typesense/typesense-java

Duplicate class org.slf4j.ILoggerFactory found in modules jetified-slf4j-api-2.0.6

RamiBadyan opened this issue · 3 comments

When I add the jar file to the libs folder and sync and then rebuild the project, it shows me this error:

Execution failed for task ':app:checkDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class org.slf4j.ILoggerFactory found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.IMarkerFactory found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.Logger found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.LoggerFactory found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.MDC found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.MDC$1 found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.MDC$MDCCloseable found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.Marker found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.MarkerFactory found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.event.EventConstants found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.event.Level found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.event.LoggingEvent found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.event.SubstituteLoggingEvent found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.BasicMDCAdapter found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.BasicMDCAdapter$1 found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.BasicMarker found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.BasicMarkerFactory found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.FormattingTuple found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.MarkerIgnoringBase found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.MessageFormatter found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.NOPLogger found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.NOPLoggerFactory found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.NOPMDCAdapter found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.NamedLoggerBase found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.SubstituteLogger found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.SubstituteLoggerFactory found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.Util found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.Util$1 found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.helpers.Util$ClassContextSecurityManager found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.spi.LocationAwareLogger found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.spi.LoggerFactoryBinder found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.spi.MDCAdapter found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)
Duplicate class org.slf4j.spi.MarkerFactoryBinder found in modules jetified-slf4j-api-2.0.6 (org.slf4j:slf4j-api:2.0.6) and jetified-typesense-java-0.0.3 (typesense-java-0.0.3.jar)

How do I fix this error ?

I received this error for Kotlin version too.
Duplicate class javax.inject.Inject found in modules jetified-javax.inject-1 (javax.inject:javax.inject:1) and jetified-typesense (typesense.jar) Duplicate class javax.inject.Named found in modules jetified-javax.inject-1 (javax.inject:javax.inject:1) and jetified-typesense (typesense.jar) Duplicate class javax.inject.Provider found in modules jetified-javax.inject-1 (javax.inject:javax.inject:1) and jetified-typesense (typesense.jar) Duplicate class javax.inject.Qualifier found in modules jetified-javax.inject-1 (javax.inject:javax.inject:1) and jetified-typesense (typesense.jar) Duplicate class javax.inject.Scope found in modules jetified-javax.inject-1 (javax.inject:javax.inject:1) and jetified-typesense (typesense.jar) Duplicate class javax.inject.Singleton found in modules jetified-javax.inject-1 (javax.inject:javax.inject:1) and jetified-typesense (typesense.jar)
Only happen if I add implementation 'com.google.firebase:firebase-messaging' to my gradle file.

@RamiBadyan @hosituan

Don't use the JAR file. The client is now available on Maven:

<dependency>
    <groupId>org.typesense</groupId>
    <artifactId>typesense-java</artifactId>
    <version>0.0.8</version>
</dependency>

Please reopen if the same issue happens on version 0.0.8 as well.