José González Gómez
04/30/2021, 11:27 AMkotest
and Android Studio
in a Kotlin multiplatform project. After adding the kotest
dependencies to build.gradle.kts
and reloading the project I get the following warning (not even an error):
Warning:<i><b>project ':partnerSDK': Unable to build Kotlin project configuration</b>
Details: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find kotest-runner-junit5-4.4.3-samplessources.jar (io.kotest:kotest-runner-junit5:4.4.3).
Searched in the following locations:
<https://repo.maven.apache.org/maven2/io/kotest/kotest-runner-junit5/4.4.3/kotest-runner-junit5-4.4.3-samplessources.jar></i>
This seems to cause Android Studio
to stop working, and I'm no longer able to use code completion, or even run unit tests. This makes test creation extremely painful.
If I manually create a test I'm able to run it using ./gradlew test
, so this is clearly not a problem with my configuration or Gradle... Has anybody faced this problem? Do you know how to solve it?wasyl
04/30/2021, 11:33 AMthis is clearly not a problem with my configuration or Gradle.Not necessarily — I’m not sure but I recall Android Studio fetching more artifacts than absolutely necessary when syncing. It might be that the configuration is off, but
test
task is not going through the wrong path. I’m not saying it’s definitely the case, just that you may want to look into some custom logic around dependencies, repositories and artifacts, if you have it-samplessources
is a weird artifact though. Do you have the same problem with Kotest 4.4.0? This is what we’re using with Android Studio without issuesJosé González Gómez
04/30/2021, 12:04 PM4.4.0
, same error
Warning:<i><b>project ':partnerSDK': Unable to build Kotlin project configuration</b>
Details: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find kotest-runner-junit5-4.4.0-samplessources.jar (io.kotest:kotest-runner-junit5:4.4.0).
Searched in the following locations:
<https://repo.maven.apache.org/maven2/io/kotest/kotest-runner-junit5/4.4.0/kotest-runner-junit5-4.4.0-samplessources.jar></i>
wasyl
04/30/2021, 12:07 PM-samplessources
anywhere in the downloaded artifactsJosé González Gómez
04/30/2021, 12:26 PMwasyl
04/30/2021, 12:27 PMsamplessources
in all places scope (so also libraries)samples
? Maybe some plugin is trying to fetch samples instead of sources and accidentaly does that for kotest as well?José González Gómez
04/30/2021, 12:36 PMManuel Luis Padilla
05/01/2021, 11:24 AM./gradlew test
would work.
I deleted the .idea/
folder and let Android Studio rebuild it. The problem never came back 🤷 . Obviously it would be interesting to know what went wrong, but if you are really stuck maybe you could try something along those lines and see if it's just a dirty state of Android Studio.José González Gómez
05/03/2021, 7:27 AMkotest
doesn't seem to support ios_x64
* What went wrong:
Execution failed for task ':partnerSDK:compileTestKotlinIosX64'.
> Could not resolve all files for configuration ':partnerSDK:iosX64TestCompileKlibraries'.
> Could not resolve io.kotest:kotest-runner-junit5:4.4.0.
Required by:
project :partnerSDK
> No matching variant of io.kotest:kotest-runner-junit5:4.4.0 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' but:
- Variant 'commonMainMetadataElements-published' capability io.kotest:kotest-runner-junit5:4.4.0 declares a usage of 'kotlin-api' of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_x64')
- Variant 'jvmApiElements-published' capability io.kotest:kotest-runner-junit5:4.4.0 declares an API of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_x64')
- Variant 'jvmRuntimeElements-published' capability io.kotest:kotest-runner-junit5:4.4.0 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_x64')
- Variant 'metadataApiElements-published' capability io.kotest:kotest-runner-junit5:4.4.0:
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_x64')
I found this in SO: https://stackoverflow.com/a/66262558/2876231kotest-assertions-core
and kotest-property
seem to have an iosx64
variant, but not kotest-runner-junit5
... can kotest
be used in a Kotlin Multiplatform Mobile project?