Duplicate class com.fleeksoft.ksoup.Ksoup found in modules ksoup-release.aar
I have an application that has an implementation dependency on two modules:
epubusescom.fleeksoft.ksoup:ksoup-okiotextextractorusescom.fleeksoft.ksoup:ksoup
When I tried to compile my application, I got:
* What went wrong:
Execution failed for task ':app-speed-reading:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.fleeksoft.ksoup.Ksoup found in modules ksoup-release.aar -> jetified-ksoup-release-runtime (com.fleeksoft.ksoup:ksoup-android:0.1.6) and ksoup-release.aar -> jetified-ksoup-release-runtime (com.fleeksoft.ksoup:ksoup-okio-android:0.1.6)
Duplicate class com.fleeksoft.ksoup.Ksoup$parseFile$1 found in modules ksoup-release.aar -> jetified-ksoup-release-runtime (com.fleeksoft.ksoup:ksoup-android:0.1.6) and ksoup-release.aar -> jetified-ksoup-release-runtime (com.fleeksoft.ksoup:ksoup-okio-android:0.1.6)
Are those ksoup modules somehow modified / differently published? This should work, but it didn't. As a workaround, I just changed the textextractor module to also use the okio ksoup extension, even though it does not need okio there.
@vanniktech You can’t use multiple variants in a single project, as it will cause conflicts.
Why is that? If you think of retrofit you can also use different adapters in parallel for instance Moshi & Gson.
@vanniktech Actually, when I started developing it, I didn’t consider this and created a single global instance. When I created the variants, I continued using the single instance approach to keep it simple with a global Ksoup object, avoiding initialization. At that time, I didn’t anticipate this kind of issue. It’s not much to do, and I’ll address it in the next release, which should be ready by the end of next week.
@vanniktech, could you please let me know if you’re still facing this issue? I believe it has been fixed since version 0.2.1.
I will check and let you know.
Yup it's fixed thanks! I did find this one though: https://github.com/fleeksoft/ksoup/issues/105