TimOrtel/GRPC-Kotlin-Multiplatform

Setup stuck on ':shared:cinteropGRPCClientIosArm64'

ncltg opened this issue · 4 comments

ncltg commented

I can't figure out how to setup the project properly while following closely the instructions from the documentation.
I tried both in my project and a fresh new one, I get stuck on the same issue in both :

Execution failed for task ':shared:cinteropGRPCClientIosArm64'.
> Could not resolve all files for configuration ':shared:iosArm64GRPCClientCInterop'.
   > Could not resolve com.github.TimOrtel.GRPC-Kotlin-Multiplatform:grpc-multiplatform-lib:0.1.1.
     Required by:
         project :shared
      > No matching variant of com.github.TimOrtel.GRPC-Kotlin-Multiplatform:grpc-multiplatform-lib:0.1.1 was found. The consumer was configured to find a usage of 'kotlin-cinterop' of a library, with the library elements 'cinterop-klib', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' but:
          - Variant 'debugApiElements-published' capability com.github.TimOrtel.GRPC-Kotlin-Multiplatform:grpc-multiplatform-lib:0.1.1 declares an API of a library:
              - Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                  - Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
                  - Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_arm64')

Any idea on the nature of this issue ? Thanks !

Have you tried using version 0.2.1? It looks like you are using 0.1.1.

ncltg commented

Indeed I wasn't using 0.2.1, thanks for that.

It seems though as if Android Studio is unable to find the package in version 0.2.1 while 0.1.1 works fine:

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(kotlin("stdlib-common"))
                api("com.github.TimOrtel.GRPC-Kotlin-Multiplatform:grpc-multiplatform-lib:0.2.1") // This one
                api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
            }
        }
        ...

Looking on JitPack.io online there seems to be errors in the build logs for 0.2.1, could that be the source of this issue ?

...
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':grpc-mp-test:compileReleaseKotlinAndroid'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details
...

Link to JitPack for your repo

Yes, I see. For now you can use version ad2a45d for the library, but keep using 0.2.1 for the plugin. I will investigate this issue.

The problem should be this missing line in the test module:
targetSourcesMap.put(OutputTarget.COMMON, listOf(kotlin.sourceSets.getByName("commonMain")))