koin
koin copied to clipboard
Can't run unit test after upgrade
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)]
can you use the latest Kotlin 1.7.x instead? Koin 3.3.x is running for Kotlin 1.7.x
@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.
the is something in your classpath that causing a conflict, apparently? 🤔 Can you reactive dependencies, one by one?
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)]
Had this same problem - was referenced here: https://github.com/InsertKoinIO/koin/issues/1526
which provides a workaround :)
@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.
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
Looks like the build.gradle
for koin-test
uses the implementation
scope instead of testImplementation
which would include test dependencies in the build
yes, ok something I can look again for 3.5.4 patch
Fixed in PR - deployed for 3.5.4