koin icon indicating copy to clipboard operation
koin copied to clipboard

Can't run unit test after upgrade

Open Osama-Mater opened this issue 2 years ago • 9 comments

Describe the bug After I upgraded the koin test deps to the latest stable version I can't run the unit-test again.

kotlin 1.8.0 gradle 7.3.1

koinTest      : "io.insert-koin:koin-test:3.3.2",
koinTestJunit4: "io.insert-koin:koin-test-junit4:3.3.2",
koinTestJunit5: "io.insert-koin:koin-test-junit5:3.3.2",

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:kaptGenerateStubsDevDebugUnitTestKotlin'.

Could not resolve all files for configuration ':app:devDebugUnitTestCompileClasspath'. Could not resolve org.jetbrains.kotlin:kotlin-test-junit5:1.8.0. Required by: project :app project :app > org.jetbrains.kotlin:kotlin-test:1.8.0 > Module 'org.jetbrains.kotlin:kotlin-test-junit5' has been rejected: Cannot select module with conflict on capability 'org.jetbrains.kotlin:kotlin-test-framework-impl:1.8.0' also provided by [org.jetbrains.kotlin:kotlin-test-junit:1.7.21(junitApi)] Could not resolve org.jetbrains.kotlin:kotlin-test-junit:1.7.21. Required by: project :app > io.insert-koin:koin-test-jvm:3.3.2 > Module 'org.jetbrains.kotlin:kotlin-test-junit' has been rejected: Cannot select module with conflict on capability 'org.jetbrains.kotlin:kotlin-test-framework-impl:1.7.21' also provided by [org.jetbrains.kotlin:kotlin-test-junit5:1.8.0(junit5Api)]

Osama-Mater avatar Jan 05 '23 00:01 Osama-Mater

can you use the latest Kotlin 1.7.x instead? Koin 3.3.x is running for Kotlin 1.7.x

arnaudgiuliani avatar Jan 27 '23 15:01 arnaudgiuliani

@arnaudgiuliani We are targeting the latest Kotlin version 1.8.0, also I tried to downgrade the Kotlin version to 1.7.21 and I was receiving the same error.

Osama-Mater avatar Jan 27 '23 15:01 Osama-Mater

the is something in your classpath that causing a conflict, apparently? 🤔 Can you reactive dependencies, one by one?

arnaudgiuliani avatar Jan 27 '23 16:01 arnaudgiuliani

Added it back again and receiving the same error

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:kaptGenerateStubsDevDebugUnitTestKotlin'.

Could not resolve all files for configuration ':app:devDebugUnitTestCompileClasspath'. Could not resolve org.jetbrains.kotlin:kotlin-test-junit5:1.3.61. Required by: project :app > Module 'org.jetbrains.kotlin:kotlin-test-junit5' has been rejected: Cannot select module with conflict on capability 'org.jetbrains.kotlin:kotlin-test-framework-impl:1.8.0' also provided by [org.jetbrains.kotlin:kotlin-test-junit:1.7.21(junitApi)] Could not resolve org.jetbrains.kotlin:kotlin-test-junit5:1.8.0. Required by: project :app > org.jetbrains.kotlin:kotlin-test:1.8.0 > Module 'org.jetbrains.kotlin:kotlin-test-junit5' has been rejected: Cannot select module with conflict on capability 'org.jetbrains.kotlin:kotlin-test-framework-impl:1.8.0' also provided by [org.jetbrains.kotlin:kotlin-test-junit:1.7.21(junitApi)] Could not resolve org.jetbrains.kotlin:kotlin-test-junit:1.7.21. Required by: project :app > io.insert-koin:koin-test-jvm:3.3.2 > Module 'org.jetbrains.kotlin:kotlin-test-junit' has been rejected: Cannot select module with conflict on capability 'org.jetbrains.kotlin:kotlin-test-framework-impl:1.7.21' also provided by [org.jetbrains.kotlin:kotlin-test-junit5:1.8.0(junit5Api)]

Screenshot 2023-02-07 at 6 28 13 PM

Osama-Mater avatar Feb 07 '23 16:02 Osama-Mater

Had this same problem - was referenced here: https://github.com/InsertKoinIO/koin/issues/1526

which provides a workaround :)

stantronic avatar Mar 04 '23 14:03 stantronic

@arnaudgiuliani The issue still happening, and we are facing more issues with the latest Koin version for creating the instances with High end devices (eg. Galaxy S20, Galaxy S21, Galaxy Z fold. Galaxy Z flip, Pixel 6 Pro, Pixel 6) and Android 13 & 12. Unfortunately we are considering replacing it with Hilt.

Osama-Mater avatar Mar 20 '23 14:03 Osama-Mater

keep returning to kotlin 1.7.21 first, to see if you pulled any conflicting lib. It's interesting to see what's going on

arnaudgiuliani avatar Mar 20 '23 14:03 arnaudgiuliani

Looks like the build.gradle for koin-test uses the implementation scope instead of testImplementation which would include test dependencies in the build

rmcmk avatar Jan 22 '24 15:01 rmcmk

yes, ok something I can look again for 3.5.4 patch

arnaudgiuliani avatar Jan 25 '24 09:01 arnaudgiuliani

Fixed in PR - deployed for 3.5.4

arnaudgiuliani avatar Mar 01 '24 09:03 arnaudgiuliani