0

我遇到了以下问题:我需要将 Kodein 添加到 KMM 项目的 Android 部分。为此,我将 Kodein 人工制品添加到模块的 build.gradle 文件中:

plugins {
    id("com.android.application")
    kotlin("android")
}

dependencies {
    implementation(project(":shared"))
    implementation("com.google.android.material:material:1.3.0")
    implementation("androidx.appcompat:appcompat:1.2.0")
    implementation("androidx.constraintlayout:constraintlayout:2.0.4")
    implementation("androidx.compose.runtime:runtime:1.0.0-beta09")
    implementation("androidx.compose.ui:ui:1.0.0-beta09")
    implementation("androidx.compose.foundation:foundation:1.0.0-beta09")
    implementation("androidx.compose.foundation:foundation-layout:1.0.0-beta09")
    implementation("androidx.compose.material:material:1.0.0-beta09")
    implementation("androidx.compose.runtime:runtime-livedata:1.0.0-beta09")
    implementation("androidx.compose.ui:ui-tooling:1.0.0-beta09")
    implementation("androidx.compose.compiler:compiler:1.0.0-beta09")
    implementation("androidx.activity:activity-compose:1.3.0-beta02")
    implementation("com.google.android.material:compose-theme-adapter:1.0.0-beta09")
    implementation("androidx.compose.material:material-icons-extended:1.0.0-beta09")
    implementation ("org.kodein.di:kodein-di-generic-jvm:7.5.1")
    implementation ("org.kodein.di:kodein-di-framework-android-x:7.5.1")
}

android {
    compileSdkVersion(30)
    defaultConfig {
        applicationId = "com.mikhailovskii.kmmtest.android"
        minSdkVersion(21)
        targetSdkVersion(30)
        versionCode = 1
        versionName = "1.0"
    }
    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }
    buildFeatures {
        compose = true
    }
    kotlinOptions {
        jvmTarget = "1.8"
        useIR = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.0.0-beta09"
        kotlinCompilerVersion = "1.5.10"
    }
}

并在项目级 build.gradle 中添加了一些行:

buildscript {
    repositories {
        gradlePluginPortal()
        jcenter()
        google()
        mavenCentral()
    }
    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
        classpath("com.android.tools.build:gradle:7.0.0-beta05")
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url = uri("https://dl.bintray.com/kotlin/kotlin-eap")
            content {
                includeGroup("org.kodein")
            }
        }
        maven(url = "https://jitpack.io")
        maven(url = "https://dl.bintray.com/kodein-framework/Kodein-DI")
    }
}

tasks.register("clean", Delete::class) {
    delete(rootProject.buildDir)
}

但是模块中没有识别出任何 Kodein 类。但是当我将人工制品的版本更改为

implementation("org.kodein.di:kodein-di-generic-jvm:5.0.1")
implementation("org.kodein.di:kodein-di-framework-android-x:5.2.0")

找到类,但我在编译时收到以下错误:

Duplicate class org.kodein.di.BindingsMapKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.BindingsMapKt$description$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.BindingsMapKt$description$2 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.BindingsMapKt$descriptionImpl$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.BindingsMapKt$fullDescription$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.BindingsMapKt$fullDescription$2 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$All found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$AllButDSL found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$BaseDSL found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$BaseDSL$Sentence found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$Companion found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$DSL found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$NonCached found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Copy$None found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.CopySpecs found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.CurryKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.CurryKt$toProvider$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.ErasedCompKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.FindDSL found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.LazyDelegate found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.PlatformKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL$Argument$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL$Binding found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL$Context$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL$Spec found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL$Spec$Companion found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL$Spec$Companion$invoke$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchDSL$tag$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchSpecs found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.SearchSpecs$NoDefinedTag found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Typed found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.Typed$Companion found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.TypedFunc found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.TypedImpl found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ArgSetBinding found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ArgSetBinding$copier$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ArgSetBinding$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ArgSetBinding$getFactory$1$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.BaseMultiBinding found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Binding found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.EagerSingleton found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.EagerSingleton$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.EagerSingleton$copier$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.EagerSingleton$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ExternalSource found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ExternalSource$Companion found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ExternalSource$Companion$invoke$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ExternalSourceKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Factory found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Factory$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.InstanceBinding found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.InstanceBinding$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Multiton found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Multiton$copier$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Multiton$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Multiton$getFactory$1$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Multiton$getFactory$1$1$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.NoScope found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Provider found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Provider$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.RefMaker found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Reference found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Scope found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ScopeCloseable found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ScopeKey found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ScopeRegistry found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.ScopesKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SetBinding found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SetBinding$copier$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SetBinding$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SetBinding$getFactory$1$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SetKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SingleItemScopeRegistry found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Singleton found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Singleton$copier$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Singleton$getFactory$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Singleton$getFactory$1$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.Singleton$getFactory$1$1$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SingletonReference found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SingletonReference$make$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SubTypes found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.SubTypesKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.TypeBinderInSet found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.TypeBinderSubTypes found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.WeakContextScope found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.bindings.WithContext found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.internal.LangKt found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.internal.TypeChecker found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.internal.TypeChecker$Down found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.internal.TypeChecker$Up found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.softReference found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.softReference$make$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.threadLocal found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.threadLocal$make$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.threadLocal$make$threadLocal$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.weakReference found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)
Duplicate class org.kodein.di.weakReference$make$1 found in modules kodein-di-core-jvm-5.2.0 (org.kodein.di:kodein-di-core-jvm:5.2.0) and kodein-di-jvm-7.5.1 (org.kodein.di:kodein-di-jvm:7.5.1)

Go to the documentation to learn how to Fix dependency resolution errors.

所以看起来这些版本是不兼容的。怎么了?我该如何解决这个问题?

4

1 回答 1

0

Kodein-DI 自 5.2 以来一直在发展。您应该能够将其添加到您的项目中

implementation("org.kodein.di:kodein-di:7.6.0")
implementation("org.kodein.di:kodein-di-framework-android-x:7.6.0")

请注意,您将跳转到 2 个主要版本,其中有重大更改,主要在 6 和 7 之间。您可以在此处遵循迁移指南: https ://docs.kodein.org/kodein-di/7.6/migration/migration- 6to7.html

于 2021-07-20T13:46:05.953 回答