Ben Brugman
03/04/2021, 1:03 PMKris Wong
03/04/2021, 2:00 PMBen Brugman
03/04/2021, 9:47 PM* What went wrong:
Execution failed for task ':shared:compileKotlinIosX64'.
> Could not resolve all files for configuration ':shared:iosX64CompileKlibraries'.
> Could not resolve org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1.
Required by:
project :shared
> No matching variant of org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' but:
- Variant 'apiElements' capability org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1 declares an API of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_x64')
- Variant 'runtimeElements' capability org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_x64')
Could i choose a different variant to fix this?
atomicfu {
dependenciesVersion = '0.15.1' // set to null to turn-off auto dependencies
transformJvm = true // set to false to turn off JVM transformation
transformJs = true // set to false to turn off JS transformation
variant = "FU" // JVM transformation variant: FU,VH, or BOTH
verbose = false // set to true to be more verbose
}
This is my shared gradleimport org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("kotlin-parcelize")
id("kotlinx-atomicfu")
}
group = "com.example.Brewster"
version = "1.0-SNAPSHOT"
kotlin {
android()
ios()
cocoapods {
summary = "Kotlin sample project with CocoaPods dependencies"
homepage = "<https://github.com/Kotlin/kotlin-with-cocoapods-sample>"
ios.deploymentTarget = "12.0"
podfile = project.file("../BrewMachine/Podfile")
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1")
kotlin("stdlib-jdk8")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val androidMain by getting {
dependencies {
implementation("com.google.android.material:material:1.2.1")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1")
}
}
val androidTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13")
}
}
val iosMain by getting{
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1")
}
}
val iosTest by getting
}
}
android {
compileSdkVersion(30)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(21)
targetSdkVersion(30)
}
}
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework =
kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1")
}