InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
9.08k stars 719 forks source link

Dependency Conflicts Koin and Kotlin #1725

Closed usamayasin-is closed 4 months ago

usamayasin-is commented 11 months ago

Koin version: 3.3.0 Kotlin version: 1.8.0

But when I run this code for my unitTest

 koinApplication {
            startKoin(this)
            androidContext(InstrumentationRegistry.getInstrumentation().targetContext.applicationContext)
            loadKoinModules(modules)
            checkModules {
                withInstance<MainActivity>()
            }
        }

Getting this exception:

'kotlin.Pair org.koin.dsl.DefinitionBindingKt.binds(kotlin.Pair, kotlin.reflect.KClass[])'
java.lang.NoSuchMethodError: 'kotlin.Pair org.koin.dsl.DefinitionBindingKt.binds(kotlin.Pair, kotlin.reflect.KClass[])'
    at org.koin.android.ext.koin.KoinExtKt$androidContext$1.invoke(KoinExt.kt:60)
    at org.koin.android.ext.koin.KoinExtKt$androidContext$1.invoke(KoinExt.kt:59)
    at org.koin.dsl.ModuleDSLKt.module(ModuleDSL.kt:40)
    at org.koin.dsl.ModuleDSLKt.module$default(ModuleDSL.kt:38)
    at org.koin.android.ext.koin.KoinExtKt.androidContext(KoinExt.kt:59)
    at com.aura.scrubber_app_base.koin.KoinInitializer$Setup$init$1$1.invoke(KoinInitializer.kt:15)
    at com.aura.scrubber_app_base.koin.KoinInitializer$Setup$init$1$1.invoke(KoinInitializer.kt:14)
    at org.koin.core.context.GlobalContext.startKoin(GlobalContext.kt:65)
    at org.koin.core.context.DefaultContextExtKt.startKoin(DefaultContextExt.kt:40)
    at com.aura.scrubber_app_base.koin.KoinInitializer$Setup.init(KoinInitializer.kt:14)
    at com.aura.appscrubber.application.ApplicationSetup$Setup.setupApplicationModules(ApplicationSetup.kt:27)
    at com.aura.appscrubber.application.AppScrubberApplication.onCreate(AppScrubberApplication.kt:19)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
    at org.robolectric.android.internal.RoboMonitoringInstrumentation.callApplicationOnCreate(RoboMonitoringInstrumentation.java:148)
    at org.robolectric.android.internal.AndroidTestEnvironment.lambda$installAndCreateApplication$2(AndroidTestEnvironment.java:381)
    at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:86)
    at org.robolectric.android.internal.AndroidTestEnvironment.installAndCreateApplication(AndroidTestEnvironment.java:379)
    at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$0(AndroidTestEnvironment.java:250)
    at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:53)
    at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$1(AndroidTestEnvironment.java:247)
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183)
    at org.robolectric.RuntimeEnvironment.lambda$getApplication$0(RuntimeEnvironment.java:80)
    at org.robolectric.shadows.ShadowInstrumentation.runOnMainSyncNoIdle(ShadowInstrumentation.java:1201)
    at org.robolectric.RuntimeEnvironment.getApplication(RuntimeEnvironment.java:80)
    at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:215)
    at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:340)
    at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:281)
    at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:101)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
pedrofsn commented 10 months ago

Which version of koin and kotlin this test was working, before the update to koin 3.3.0?

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.