korlibs-archive/krypto

Could not resolve com.soywiz.korlibs.krypto:krypto-metadata:1.9.2.

Closed this issue · 10 comments

This works fine when using gradle 4.10.1

however, it fails using gradle 6.1.1,

repositories in build.gradle

repositories {
    google()
    jcenter()
    maven { url "https://kotlin.bintray.com/kotlinx" }
    maven { url 'https://dl.bintray.com/kotlinx/kotlinx' }
    maven { url "https://jitpack.io" }
    maven { url "http://dl.bintray.com/kotlin/ktor" }
    maven { url "https://dl.bintray.com/korlibs/korlibs" }
    maven { url 'https://dl.bintray.com/kotlin/kotlin-js-wrappers' }
    mavenCentral()
}

Console output

Could not resolve com.soywiz.korlibs.klock:klock-metadata:1.8.9.
     Required by:
         project : > com.github.andylamax.asoft-auth:asoft-auth-metadata:30.0.0
      > Unable to find a matching variant of com.soywiz.korlibs.klock:klock-metadata:1.8.9:
          - Variant 'metadata-api' capability com.soywiz.korlibs.klock:klock-metadata:1.8.9:
              - Incompatible attributes:
                  - Required org.gradle.usage 'kotlin-runtime' and found incompatible value 'kotlin-api'.
                  - Required org.jetbrains.kotlin.platform.type 'js' and found incompatible value 'common'.
              - Other attribute:
                  - Found org.gradle.status 'release' but wasn't required.
   > Could not resolve com.soywiz.korlibs.krypto:krypto-metadata:1.9.2.
     Required by:
         project : > com.github.andylamax.asoft-auth:asoft-auth-metadata:30.0.0
      > Unable to find a matching variant of com.soywiz.korlibs.krypto:krypto-metadata:1.9.2:
          - Variant 'metadata-api' capability com.soywiz.korlibs.krypto:krypto-metadata:1.9.2:
              - Incompatible attributes:
                  - Required org.gradle.usage 'kotlin-runtime' and found incompatible value 'kotlin-api'.
                  - Required org.jetbrains.kotlin.platform.type 'js' and found incompatible value 'common'.
              - Other attribute:
                  - Found org.gradle.status 'release' but wasn't required.

What am I doing wrong?

This happens with the klock lib too

I figured it out using the GradleMetadata

Still a problem

Can you check 1.10.0?

Also you might need to specify some attributes when using metadata

Can you check 1.10.0?

Also you might need to specify some attributes when using metadata

I get the same error. May I know what attributes I have to specify?

Are you targeting kotlin multiplatform, or a specific target? Do you have your whole build.gradle and settings.gradle somewhere so I can check?

build.gradle

buildscript {
    ext {
        kotlin_version = '1.3.70'
        serialization_version = "0.14.0"
        klock_version = "1.10.0"
        asoft_neo4j_version = "2.0.0"
        persist_version = "16.0.0"
        rx_version = "6.2.0"
        asoft_phone_version = "1.0.0"
        asoft_email_version = "1.0.0"
        krypto_version = "1.10.0"
        asoft_io_version = "3.1.0"
        test_version = "4.2.0"
        android_tools_version = "3.6.0"//"3.3.2"
    }

    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:$android_tools_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
    }
}

plugins {
    id 'kotlin-multiplatform' version '1.3.70'
}

group 'tz.co.asoft'
version '30.1.0'

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'kotlinx-serialization'

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 1
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    sourceSets {
        main {
            manifest.srcFile 'src/androidMain/AndroidManifest.xml'
            resources.srcDirs = ['src/androidMain/resources']
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    google()
    jcenter()
//    mavenCentral()
    maven { url "https://kotlin.bintray.com/kotlinx" }
    maven { url 'https://dl.bintray.com/kotlinx/kotlinx' }
    maven { url "https://jitpack.io" }
    maven { url "http://dl.bintray.com/kotlin/ktor" }
//    maven { url "https://dl.bintray.com/korlibs/korlibs" }
    maven { url 'https://dl.bintray.com/kotlin/kotlin-js-wrappers' }
}


kotlin {
    jvm() {
        compilations.all {
            tasks[compileKotlinTaskName].kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    }

    android() {
        compilations.all {
            tasks[compileKotlinTaskName].kotlinOptions {
                jvmTarget = "1.8"
            }
        }

        publishLibraryVariants("release")
    }

    js() {
        compilations.all {
            tasks[compileKotlinTaskName].kotlinOptions {
                metaInfo = true
                sourceMap = true
                moduleKind = 'commonjs'
            }
        }
    }

    sourceSets {
        commonMain {
            dependencies {
                implementation kotlin('stdlib-common')
                api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
                api "com.github.andylamax.asoft-persist:asoft-persist-metadata:$persist_version"
                api "com.github.andylamax.asoft-rx:asoft-rx-metadata:$rx_version"
                api "com.github.andylamax.asoft-neo4j:asoft-neo4j-metadata:$asoft_neo4j_version"
                api "com.github.andylamax.asoft-io:asoft-io-metadata:$asoft_io_version"
                api "com.github.andylamax.asoft-email:asoft-email-metadata:$asoft_email_version"
                api "com.github.andylamax.asoft-phone:asoft-phone-metadata:$asoft_phone_version"
            }
        }

        commonTest {
            dependencies {
                implementation "com.github.andylamax.asoft-test:asoft-test-metadata:$test_version"
            }
        }

        androidMain {
            dependencies {
                implementation kotlin('stdlib')
                api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
//                api "com.soywiz.korlibs.klock:klock-android:$klock_version"

                api "com.github.andylamax.asoft-persist:asoft-persist-android:$persist_version"
                api "com.github.andylamax.asoft-rx:asoft-rx-android:$rx_version"
                api "com.github.andylamax.asoft-neo4j:asoft-neo4j-android:$asoft_neo4j_version"
                api "com.github.andylamax.asoft-io:asoft-io-android:$asoft_io_version"

                api "com.github.andylamax.asoft-email:asoft-email-android:$asoft_email_version"
                api "com.github.andylamax.asoft-phone:asoft-phone-android:$asoft_phone_version"
            }
        }

        androidTest {
            dependencies {
                implementation "com.github.andylamax.asoft-test:asoft-test-android:$test_version"
            }
        }

        jvmMain {
            dependencies {
                implementation kotlin('stdlib')
                api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
//                api "com.soywiz.korlibs.klock:klock-jvm:$klock_version"

                api "com.github.andylamax.asoft-persist:asoft-persist-jvm:$persist_version"
                api "com.github.andylamax.asoft-rx:asoft-rx-jvm:$rx_version"
                api "com.github.andylamax.asoft-neo4j:asoft-neo4j-jvm:$asoft_neo4j_version"
                api "com.github.andylamax.asoft-io:asoft-io-jvm:$asoft_io_version"

                api "com.github.andylamax.asoft-email:asoft-email-jvm:$asoft_email_version"
                api "com.github.andylamax.asoft-phone:asoft-phone-jvm:$asoft_phone_version"
            }
        }

        jvmTest {
            dependencies {
                implementation "com.github.andylamax.asoft-test:asoft-test-jvm:$test_version"
            }
        }

        jsMain {
            dependencies {
                implementation kotlin('stdlib-js')
                api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version"

//                api "com.soywiz.korlibs.klock:klock-js:$klock_version"
                api "com.github.andylamax.asoft-persist:asoft-persist-js:$persist_version"
                api "com.github.andylamax.asoft-rx:asoft-rx-js:$rx_version"
                api "com.github.andylamax.asoft-neo4j:asoft-neo4j-js:$asoft_neo4j_version"
                api "com.github.andylamax.asoft-io:asoft-io-js:$asoft_io_version"

                api "com.github.andylamax.asoft-email:asoft-email-js:$asoft_email_version"
                api "com.github.andylamax.asoft-phone:asoft-phone-js:$asoft_phone_version"
            }
        }

        jsTest {
            dependsOn jsMain
            dependencies {
                implementation "com.github.andylamax.asoft-test:asoft-test-js:$test_version"
            }
        }
    }
}

dependencies {
    // I tried adding this block after multiple failed attempts
    commonMainApi "com.soywiz.korlibs.klock:klock-metadata:$klock_version"
    commonMainApi "com.soywiz.korlibs.krypto:krypto-metadata:$krypto_version"
    androidMainApi "com.soywiz.korlibs.klock:klock-android:$klock_version"
    androidMainApi "com.soywiz.korlibs.krypto:krypto-android:$krypto_version"
    jvmMainApi "com.soywiz.korlibs.klock:klock-jvm:$klock_version"
    jvmMainApi "com.soywiz.korlibs.krypto:krypto-jvm:$krypto_version"
    jsMainApi "com.soywiz.korlibs.klock:klock-js:$klock_version"
    jsMainApi "com.soywiz.korlibs.krypto:krypto-js:$krypto_version"
}

Settings.gradle

pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "kotlin-multiplatform") {
                useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
            }
        }
    }

    repositories {
        mavenCentral()

        maven { url 'https://plugins.gradle.org/m2/' }
    }
}

rootProject.name = 'asoft-auth'

As far as I can tell, you just need to put:

dependencies {
    commonMainApi "com.soywiz.korlibs.krypto:krypto:$krypto_version"
}

@andylamax is there still a problem with it?

if your targeting android, try to set matching fallbacks to your release buildType. That did the trick for me on this one