https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

menegatti

12/05/2018, 9:35 PM
Guys, I'm trying to generate a iOS framework to be used by Xcode, but when I build, the project stops recognizing coroutines. I created the task defined here https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html#tuning-the-gradle-build-script and my
common/build.gradle
file is :
Copy code
apply plugin: 'kotlin-multiplatform'

kotlin {
    targets {
        fromPreset(presets.jvm, 'jvm')
        final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
                              ? presets.iosArm64 : presets.iosX64

        fromPreset(iOSTarget, 'iOS') {
            compilations.main.outputKinds('FRAMEWORK')
        }
    }

    sourceSets {
        commonMain {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
            }
        }

        jvmMain {
            dependencies {
                implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
            }
        }

        iOSMain {
            dependencies {
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
            }
        }
    }
}
Here's the terminal output
Copy code
kotlin_version=1.3.10
coroutines_version=1.0.0
s

Sabrina Namur

12/06/2018, 7:44 AM
It looks like the problem I had. I changed the "fromPresent(iOSTarget, iOS)" to "fromPresent(iOSTarget, ios)" and ajdust the variable in the path for the task. (I mean the "kotlin.target.iOS....")
3 Views