2

I got this error when I adding coil dependency to Compose Desktop project.

Compose version: 1.0.0

Kotlin version: 1.5.31

Error:

Execution failed for task ':compileKotlin'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve io.coil-kt:coil-compose:1.4.0.
     Required by:
         project :
      > No matching variant of io.coil-kt:coil-compose:1.4.0 was found. The consumer was configured to find an API of a library compatible with Java 15, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
          - Variant 'releaseApiPublication' capability io.coil-kt:coil-compose:1.4.0 declares an API of a library, and its dependencies declared externally:
              - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 15)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
          - Variant 'releaseRuntimePublication' capability io.coil-kt:coil-compose:1.4.0 declares a runtime of a library, and its dependencies declared externally:
              - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 15)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')

beigirad
  • 4,986
  • 2
  • 29
  • 52
  • 2
    Coil is an Android library, and so far it does not support Desktop. It uses a lot of Android primitives that are not available in the JVM, so it is not easy to implement this feature. You can keep an eye on [this feature request](https://github.com/coil-kt/coil/issues/842) for updates. – Phil Dukhov Jan 24 '22 at 02:42
  • 1
    same. I get the same repetitive error. But with "Duplicate class androidx.appcompat.content.res.AppCompatResources found in modules appcompat-1.0.0-runtime" – Branddd Jan 29 '22 at 12:12

1 Answers1

1

Coil required specific Android libraries in order to load an image, and that libraries only exist in the Android framework, so you can't use it on desktop

You can check out the this tutorial if you want to load an image in compose desktop

Ahmed Hnewa
  • 1,185
  • 1
  • 4
  • 14