"Duplicate class .. found in modules ..." triggered by appcompat and lets-plot-common libraries
See original GitHub issueI am using the kotlin lets plot api, which works 100% on jupyter and in standalone apps,
however I’m trying to use it on an android app and at the moment to build I get a bunch of errors that say like this
Duplicate class kotlin.ArrayIntrinsicsKt found in modules jetified-kotlin-stdlib-1.3.72.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.72) and jetified-lets-plot-common-1.3.1.jar (org.jetbrains.lets-plot:lets-plot-common:1.3.1)
and
Duplicate class org.jetbrains.annotations.TestOnly found in modules jetified-annotations-13.0.jar (org.jetbrains:annotations:13.0) and jetified-lets-plot-common-1.3.1.jar (org.jetbrains.lets-plot:lets-plot-common:1.3.1)
I understand that I have to choose only one of the libraries to be compiled, but if I remove lets-plot from the gradle the project renders unusable at ‘grafica.kt’
My question is:
Can I remove ‘org.jetbrains.kotlin:kotlin-stdlib:1.3.72’ and ‘org.jetbrains:annotations:13.0’ safely? and If so, how can I do this?
Thanks in advance!
Project description: User inputs two numbers and the app displays a plot of them
I’ve opened the same issue at :
https://youtrack.jetbrains.com/issue/KT-39737
where I’ve attached a sample project
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
@descent2oblivion I’ve done what @ilya-g suggested. Could you try upgrading to lets-plot-kotlin-api 0.0.22-SNAPSHOT ? It depends on lets-plot-common 1.4.3-SNAPSHOT which is clear from Kotlin and other external dependencies.
It looks like
lets-plot-common.jar
artifact is an uber-jar that bundles classes from all of its dependencies, includingkotlin-stdlib
. This approach can cause problems in certain environments, for example in the modular Java environment on the module path or in Android apps as described above.Consider providing your main artifact
lets-plot-api
that lists all its dependencies as plain dependencies instead of bundling them, and provide an uber-jar if needed as a distinct artifact variant or a separate artifact.