Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin Multiplatform - Could not resolve dependencies #4095

Closed
ynsok opened this issue May 11, 2022 · 12 comments
Closed

Kotlin Multiplatform - Could not resolve dependencies #4095

ynsok opened this issue May 11, 2022 · 12 comments

Comments

@ynsok
Copy link

ynsok commented May 11, 2022

Summary
Could not resolve com.apollographql.apollo3:apollo-runtime:3.3.0.

Version
3.3.0

Description
I'm writing a project in kotlin multiplatform, my targets are Android and JVM. I can't add dependencies to the project

image

@benjamn @glasser @xrd @martijnwalraven

@ynsok ynsok changed the title Could not resolve dependencies Kotlin Multiplatform - Could not resolve dependencies May 11, 2022
@martinbonnin
Copy link
Contributor

Hi 👋

You'll need to declare repositories to download the artifacts from. Something like:

repositories {
  mavenCentral()
}

@ynsok
Copy link
Author

ynsok commented May 11, 2022

Hi @martinbonnin ,
Still the same

image

@martinbonnin
Copy link
Contributor

martinbonnin commented May 11, 2022

Other things to try:

  • bumping your Gradle version (what version are you on?)
  • using com.apollographql.apollo3:apollo-runtime-jvm:3.3.0 instead (edit: snap that, you're on multiplatform so that won't help)
  • running from the command line

The artifacts are there so there has to be a way to download them from your project

@martinbonnin
Copy link
Contributor

Also something worth investigating is the baseAndroidSetup(). Maybe that configures something eagerly? I usually try to put the plugins {} block as close as possible to the beginning of the script.
In all cases, it's pretty hard to tell without more info. If you could send a reproducer, that'd be greatly appreciated.

You can also take a look at Confetti, a sample multiplatform project that uses 3.3.0. Maybe that can give you a hint.

Let us know what you find!

@ynsok
Copy link
Author

ynsok commented May 11, 2022

@martinbonnin
I'm not sure what is going on, but I'm able to use apollo com.apollographql.apollo3:apollo-gradle-plugin:3.2.2 But while I'm trying to bump it throws me the same error

@martinbonnin
Copy link
Contributor

3.3.0 enables HMPP which is potentially a big change for dependency management. Can you run from the command line and share the results here?

./gradlew build

@ynsok
Copy link
Author

ynsok commented May 11, 2022

It looks like, version 3.3.0 works only on android. CommonMain and DekstopMain throw error

image

@martinbonnin
Copy link
Contributor

Interesting! Can you try from the command line? The IDE can get choppy sometimes so it's really hard to tell the exact error from screenshots.

@ynsok
Copy link
Author

ynsok commented May 11, 2022

While I'm run ./gradlew build I'm getting this information

`Execution failed for task ':data:compileKotlinMetadata'.

Error while evaluating property 'filteredArgumentsMap' of task ':data:compileKotlinMetadata'
Could not resolve all files for configuration ':data:metadataCompileClasspath'.
> Could not resolve com.apollographql.apollo3:apollo-runtime:3.3.0.
Required by:
project :data
> The consumer was configured to find a usage of 'kotlin-api' of a library, preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common'. However we cannot choose between the following variants of com.apollographql.apollo3:apollo-runtime:3.3.0:
- iosArm64ApiElements-published
- iosSimulatorArm64ApiElements-published
- iosX64ApiElements-published
- jsIrApiElements-published
- jsLegacyApiElements-published
- jvmApiElements-published
- jvmRuntimeElements-published
- macosArm64ApiElements-published
- macosX64ApiElements-published
- tvosArm64ApiElements-published
- tvosSimulatorArm64ApiElements-published
- tvosX64ApiElements-published
- watchosArm64ApiElements-published
- watchosSimulatorArm64ApiElements-published
All of them match the consumer attributes:
- Variant 'iosArm64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' but the consumer didn't ask for it
- Variant 'iosSimulatorArm64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' but the consumer didn't ask for it
- Variant 'iosX64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' but the consumer didn't ask for it
- Variant 'jsIrApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
- Unmatched attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.js.compiler' with value 'ir' but the consumer didn't ask for it
- Variant 'jsLegacyApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
- Unmatched attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.js.compiler' with value 'legacy' but the consumer didn't ask for it
- Variant 'jvmApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares an API of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Unmatched attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'jvmRuntimeElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a runtime of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Unmatched attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'macosArm64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'macos_arm64' but the consumer didn't ask for it
- Variant 'macosX64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'macos_x64' but the consumer didn't ask for it
- Variant 'tvosArm64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_arm64' but the consumer didn't ask for it
- Variant 'tvosSimulatorArm64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_simulator_arm64' but the consumer didn't ask for it
- Variant 'tvosX64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_x64' but the consumer didn't ask for it
- Variant 'watchosArm64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_arm64' but the consumer didn't ask for it
- Variant 'watchosSimulatorArm64ApiElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_simulator_arm64' but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'iosArm64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'iosSimulatorArm64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'iosX64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'jsIrRuntimeElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
- Incompatible because this component declares a usage of 'kotlin-runtime' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'jsLegacyRuntimeElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
- Incompatible because this component declares a usage of 'kotlin-runtime' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'macosArm64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'macosX64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'metadataApiElements' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'tvosArm64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'tvosSimulatorArm64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'tvosX64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'watchosArm64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'watchosSimulatorArm64MetadataElements-published' capability com.apollographql.apollo3:apollo-runtime:3.3.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
`

@martinbonnin
Copy link
Contributor

Gotcha, thanks for providing this🙏. This does look like a HMPP issue. I'd recommend you either:

  1. update to Kotlin 1.6.21

or

  1. add this workaround in your build.gradle.kts
  // Workaround for https://youtrack.jetbrains.com/issue/KT-51970
  afterEvaluate {
    afterEvaluate {
      tasks.configureEach {
        if (
            name.startsWith("compile")
            && name.endsWith("KotlinMetadata")
        ) {
          println("disabling ${this@subprojects}:$name")
          enabled = false
        }
      }
    }
  }

It will disable the metadata task in your project but you don't need it unless you're publishing an app (which doesn't sound to be the case here). See https://youtrack.jetbrains.com/issue/KT-51970 for more details

@ynsok
Copy link
Author

ynsok commented May 11, 2022

bumb kotlin to 1.6.21 helped !!!

Thanks so much !!!! 😄 😄

@martinbonnin
Copy link
Contributor

Awesome, glad I could help :). Sorry the HMPP transition is a bit of a bumpy road. We're working on some blog post to hopefully streamline this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants