Resolving Duplicate Classes Error with Typesense and Kotlin
TLDR Matt faced "Duplicate class" errors in a Kotlin Android app after adding Typesense dependency. Kishore Nallan suggested excluding conflicting groups which resolved the issue.


Feb 16, 2023 (7 months ago)
Matt
08:13 AMTo start with, I created a sample project. After adding the Typesense dependency
implementation 'org.typesense:typesense-java:0.0.8'
I get Duplicate class found
error, build output:Duplicate class com.fasterxml.jackson.annotation.JacksonAnnotation found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JacksonAnnotationValue found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JacksonAnnotationsInside found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JacksonInject found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JacksonInject$Value found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonAlias found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonAnyGetter found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonAnySetter found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonAutoDetect found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonAutoDetect$1 found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonAutoDetect$Value found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonBackReference found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonClassDescription found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonCreator found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonCreator$Mode found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonEnumDefaultValue found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonFilter found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonFormat found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonFormat$Feature found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonFormat$Features found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonFormat$Shape found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonFormat$Value found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonGetter found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIdentityInfo found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIdentityReference found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIgnore found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIgnoreProperties found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIgnoreProperties$Value found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIgnoreType found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonInclude found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonInclude$Include found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonInclude$Value found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIncludeProperties found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonIncludeProperties$Value found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonKey found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonManagedReference found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonMerge found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonProperty found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonProperty$Access found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonPropertyDescription found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonPropertyOrder found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonRawValue found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonRootName found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonSetter found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonSetter$Value found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonSubTypes found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonSubTypes$Type found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8 (org.typesense:typesense-java:0.0.8)
Duplicate class com.fasterxml.jackson.annotation.JsonTypeId found in modules jackson-annotations-2.14.1 (com.fasterxml.jackson.core:jackson-annotations:2.14.1) and typesense-java-0.0.8
(...)
Is there any recommended way to deal with this?
Kishore Nallan
08:15 AMMatt
08:19 AMKishore Nallan
08:22 AMconfigurations {
cleanedAnnotations
implementation.exclude group: 'org.jetbrains' , module:'annotations'
implementation.exclude group: 'org.jetbrains.kotlin' , module:'kotlin-stdlib'
}
Matt
08:36 AMKishore Nallan
08:38 AM
Matt
08:40 AMKishore Nallan
08:42 AMMatt
08:44 AMMatt
09:36 AMminSdkVersion = 26```
configurations {cleanedAnnotations
implementation.exclude group: 'org.jetbrains' , module:'annotations'
implementation.exclude group: 'org.jetbrains.kotlin' , module:'kotlin-stdlib'
implementation.exclude group: 'org.apache.logging.log4j' , module:'log4j-api'
implementation.exclude group: 'org.apache.logging.log4j' , module:'log4j-core'
implementation.exclude group: 'com.squareup.okio' , module:'okio'
implementation.exclude group: 'com.squareup.okhttp3' , module:'okhttp'
implementation.exclude group: 'jakarta.xml.bind' , module:'jakarta.xml.bind-api'
implementation.exclude group: 'javax.xml.bind' , module:'jaxb-api'
implementation.exclude group: 'jakarta.activation' , module:'jakarta.activation-api'
implementation.exclude group: 'io.swagger.core.v3' , module:'swagger-annotations'
implementation.exclude group: 'com.fasterxml.jackson.module' , module:'jackson-module-jaxb-annotations'
}```
Kishore Nallan
09:41 AMMatt
09:50 AMdependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
//Typesense client
implementation 'org.typesense:typesense-java:0.0.8'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
Kishore Nallan
09:52 AM
Typesense
Indexed 2764 threads (79% resolved)
Similar Threads
Resolving ClassNotFoundException in Android while using Typesense
Amal encountered a ClassNotFoundException while setting up Typesense in Android. Kishore Nallan recommended using Stack Overflow and Maven to resolve the issue. They also provided a fix for the Java client on Android, which worked for Amal.

Troubleshooting Issues with DocSearch Hits and Scraper Configuration
Rubai encountered issues with search result priorities and ellipsis. Jason helped debug the issue and suggested using different versions of typesense-docsearch.js, updating initialization parameters, and running the scraper on a Linux-based environment. The issues related to hits structure and scraper configuration were resolved.



Resolving Multilingual Search Function in Typesense Software
Bill is having difficulty with multilingual search functionality in Typesense software. Developer Kishore Nallan suggested setting a language locale and provided a demo build. The build solution had some issues, and after multiple rounds of software updates and troubleshooting, the problem still persists.


Troubleshooting Typesense Issues in Kubectl v1.26
Arnob and Rubai face issues with Typesense erasing data. Jason and Kishore Nallan suggest HA setup and persistent volume usage. Sai recommends the Typesense Kubernetes operator but Arnob experiences new errors.

Typesense Java Client Okhttp Version Conflict
Ashish faced an error with Typesense Java okhttp version. Kishore Nallan helped identify the conflict with Spring Boot version, which updated okhttp to a compatible version.