I've a simple Android application project in Android Studio, where I am including this dependency in build.gradle:
dependencies {
// dependency I care about:
implementation 'org.typesense:typesense-java:0.0.9-beta9'
// other android deps
implementation 'androidx.core:core-ktx:1.9.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'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
// test deps
testImplementation 'junit:junit:4.13.2'
}
When I build the project, I get lots of errors about duplicate classes. Example:
Duplicate class com.fasterxml.jackson.databind.type.ArrayType found in modules jackson-databind-2.14.1 (com.fasterxml.jackson.core:jackson-databind:2.14.1) and typesense-java-0.0.9-beta9 (org.typesense:typesense-java:0.0.9-beta9)
Duplicate class okio.Throttler found in modules okio-jvm-2.8.0 (com.squareup.okio:okio:2.8.0) and typesense-java-0.0.9-beta9 (org.typesense:typesense-java:0.0.9-beta9)
I'm not using any other library that uses these dependencies so I don't know what is happening.
Now, the interesting thing is that when I actually download the JAR directly from Maven Central and depend on it as a local JAR, the errors vanish!
implementation files('libs/typesense-java-0.0.9-beta9.jar')
Also, when I use the dependency in a vanilla Java/gradle project, I don't face any issues. What is going wrong here?
In case it helps, here's the source of the library I'm trying to depend on.
from Android: duplicate classes errors only when using remote dependency but not local JAR
No comments:
Post a Comment