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

Cant add dependency for desktop target #162

Open
andrea-liu87 opened this issue Jan 5, 2025 · 0 comments
Open

Cant add dependency for desktop target #162

andrea-liu87 opened this issue Jan 5, 2025 · 0 comments

Comments

@andrea-liu87
Copy link

andrea-liu87 commented Jan 5, 2025

Hello. I am trying to use this library for my weather app. The app is targeting Android, iOS & Desktop. However, it seems always failed during gradle build.

    sourceSets {
        val commonMain by getting {
            dependencies {
             //other libraries
                implementation(libs.compass.geolocation)
            }
        }

        val mobileMain by creating {
            dependsOn(commonMain)
            dependencies {
                implementation(libs.compass.geolocation.mobile)
            }
        }

        val nonMobileMain by creating {
            dependsOn(commonMain)
            dependencies {
                implementation(libs.compass.geolocation.browser)
            }
        }

        val androidMain by getting {
            dependsOn(mobileMain)
            dependencies {
                implementation(libs.compose.ui.tooling.preview)
                implementation(libs.androidx.activity.compose)
                implementation(libs.ktor.client.cio)
                implementation(libs.kstore.file)
                implementation ("com.google.accompanist:accompanist-systemuicontroller:0.27.0")
                implementation("androidx.startup:startup-runtime:1.1.1")
            }
        }

        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            dependsOn(mobileMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
            iosSimulatorArm64Main.dependsOn(this)
            dependencies {
                implementation(libs.ktor.client.darwin)
                implementation(libs.kstore.file)
            }
        }

        val desktopMain by getting {
            dependsOn(nonMobileMain)
            dependencies {
                implementation(libs.ktor.client.cio)
                implementation(libs.kstore.file)
                implementation(compose.desktop.currentOs)
                implementation(libs.harawata.appdirs)
                implementation(libs.compose.ui.tooling.preview.jetbrain)
            }
        }

Stack trace :

Execution failed for task ':composeApp:compileKotlinDesktop'.
> Could not resolve all files for configuration ':composeApp:desktopCompileClasspath'.
   > Could not resolve dev.jordond.compass:geolocation-browser:1.2.2.
     Required by:
         project :composeApp
      > No matching variant of dev.jordond.compass:geolocation-browser:1.2.2 was found. The consumer was configured to find a library for use during compile-time, preferably optimized for standard JVMs, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
          - Variant 'jsApiElements-published' declares a library, preferably optimized for non-jvm:
              - Incompatible because this component declares a component for use during 'kotlin-api', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js' and the consumer needed a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
          - Variant 'jsRuntimeElements-published' declares a library, preferably optimized for non-jvm:
              - Incompatible because this component declares a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js' and the consumer needed a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
          - Variant 'jsSourcesElements-published' declares a component, preferably optimized for non-jvm:
              - Incompatible because this component declares documentation for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js' and the consumer needed a library for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
          - Variant 'metadataApiElements' declares a library, preferably optimized for non-jvm:
              - Incompatible because this component declares a component for use during 'kotlin-metadata', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
          - Variant 'metadataSourcesElements' declares a component, preferably optimized for non-jvm:
              - Incompatible because this component declares documentation for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a library for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
          - Variant 'wasmJsApiElements-published' declares a library, preferably optimized for non-jvm:
              - Incompatible because this component declares a component for use during 'kotlin-api', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm' and the consumer needed a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
          - Variant 'wasmJsRuntimeElements-published' declares a library, preferably optimized for non-jvm:
              - Incompatible because this component declares a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm' and the consumer needed a component for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
          - Variant 'wasmJsSourcesElements-published' declares a component, preferably optimized for non-jvm:
              - Incompatible because this component declares documentation for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm' and the consumer needed a library for use during compile-time, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
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

1 participant