I'm using two library that have dependencies of two different versions of Koin.
One of the library has org.koin:koin-android:2.0.1 and the other has io.insert-koin:koin-core-jvm:3.0.1 dependencies.
At compile time I got tons of Duplicate class error as below,
Duplicate class org.koin.android.BuildConfig found in modules jetified-koin-android-2.0.1-runtime (org.koin:koin-android:2.0.1) and jetified-koin-android-3.0.1-runtime (io.insert-koin:koin-android:3.0.1)
Duplicate class org.koin.android.ext.koin.KoinExtKt$androidContext$1 found in modules jetified-koin-android-2.0.1-runtime (org.koin:koin-android:2.0.1) and jetified-koin-android-3.0.1-runtime (io.insert-koin:koin-android:3.0.1)
Duplicate class org.koin.core.scope.Scope$injectOrNull$1 found in modules jetified-koin-core-2.0.1 (org.koin:koin-core:2.0.1) and jetified-koin-core-jvm-3.0.1 (io.insert-koin:koin-core-jvm:3.0.1)
Duplicate class org.koin.java.KoinJavaComponent$inject$1 found in modules jetified-koin-core-jvm-3.0.1 (io.insert-koin:koin-core-jvm:3.0.1) and jetified-koin-java-2.0.1 (org.koin:koin-java:2.0.1)
...
When I try to exclude one of them as below,
configurations {
all {
exclude group: "io.insert-koin", module: "koin-android"
exclude group: "io.insert-koin", module: "koin-core-jvm"
}
}
I got NoClassDefFoundError at runtime on the relevant one.
When exclude org.koin:koin-android:2.0.1
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.koin.core.KoinComponent" on path: DexPathList[[zip file "/data/app/...
When exclude io.insert-koin:koin-core-jvm:3.0.1
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.koin.core.component.KoinComponent" on path: DexPathList[[zip file "/data/app/...
How can I get to use both libraries?