ksoup icon indicating copy to clipboard operation
ksoup copied to clipboard

Duplicate class com.fleeksoft.ksoup.Ksoup found in modules ksoup-release.aar

Open vanniktech opened this issue 1 year ago • 3 comments

I have an application that has an implementation dependency on two modules:

  • epub uses com.fleeksoft.ksoup:ksoup-okio
  • textextractor uses com.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 avatar Sep 09 '24 11:09 vanniktech

@vanniktech You can’t use multiple variants in a single project, as it will cause conflicts.

itboy87 avatar Sep 09 '24 11:09 itboy87

Why is that? If you think of retrofit you can also use different adapters in parallel for instance Moshi & Gson.

vanniktech avatar Sep 09 '24 12:09 vanniktech

@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.

itboy87 avatar Sep 10 '24 06:09 itboy87

@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.

itboy87 avatar Dec 13 '24 06:12 itboy87

I will check and let you know.

vanniktech avatar Dec 13 '24 11:12 vanniktech

Yup it's fixed thanks! I did find this one though: https://github.com/fleeksoft/ksoup/issues/105

vanniktech avatar Dec 13 '24 12:12 vanniktech