Using the new multi-platform gradle plugin to buil...
# kotlin-native
r
Using the new multi-platform gradle plugin to build a MP module(android/JS/iOS) with grade 4.7 with metadata enabled. When I try to define cinterop for an objC/swift dependency (firebase-firestorm-ios) and have 'kotlinx-coroutines-core-native' as a dependency I get an error (only when defining cinterop): * What went wrong: Could not resolve all files for configuration 'common alliOSFirestoreCInterop'.
Could not resolve org.jetbrains.kotlinxkotlinx coroutines core native1.0.1.
Required by: project :common-all > Unable to find a matching configuration of org.jetbrains.kotlinxkotlinx coroutines core native1.0.1: - Configuration 'debugIos_arm32Link': - Found org.gradle.native.debuggable 'true' but wasn't required. - Found org.gradle.native.optimized 'false' but wasn't required. - Found org.gradle.status 'release' but wasn't required. - Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-api'. - Required org.jetbrains.kotlin.native.target 'ios_arm64' and found incompatible value 'ios_arm32'. - Required org.jetbrains.kotlin.platform.type 'native' and found compatible value 'native'. - Configuration 'debugIos_arm64Link': - Found org.gradle.native.debuggable 'true' but wasn't required. - Found org.gradle.native.optimized 'false' but wasn't required. - Found org.gradle.status 'release' but wasn't required. - Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-api'. - Required org.jetbrains.kotlin.native.target 'ios_arm64' and found compatible value 'ios_arm64'. - Required org.jetbrains.kotlin.platform.type 'native' and found compatible value 'native'. - Configuration 'debugIos_x64Link': - Found org.gradle.native.debuggable 'true' but wasn't required. - Found org.gradle.native.optimized 'false' but wasn't required. - Found org.gradle.status 'release' but wasn't required. - Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-api'. - Required org.jetbrains.kotlin.native.target 'ios_arm64' and found incompatible value .... The build file can be found here: https://github.com/RubyLichtenstein/Kotlin-Multiplatform-Firebase/blob/ios/common-all/build.gradle Any ideas? I suppose since I was targeting 'iosArm64' that the correct configuration should have been 'debugIos_arm64Link' but there is a mismatch due to 'Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-api''.
i
It's a known problem with a cinterop in 1.3.0 and it is fixed in 1.3.10. As a workaround you can manually specify the needed attributes, just add this code snippet in your build script:
Copy code
kotlin.targets.matching { it.platformType.name == 'native' }.all {
    compilations.all { 
        cinterops.all {
            configurations[dependencyConfigurationName].attributes.attribute(
                Usage.USAGE_ATTRIBUTE, 
                objects.named(Usage, 'kotlin-api')
            )
        }
    }
}
👍 1
r
Thanks. I forgot to update. It is also already fixed in more recent dev releases of the plugin.