0

I am trying to add kmm shared module to my ios/android app however, I got this message from Xcode run

Showing Recent Messages A problem occurred configuring project ':shared'.

> Could not identify build type for Kotlin framework 'shared' built via cocoapods plugin with CONFIGURATION=Staging.

  Add xcodeConfigurationToNativeBuildType["Staging"]=NativeBuildType.DEBUG or xcodeConfigurationToNativeBuildType["Staging"]=NativeBuildType.RELEASE to cocoapods plugin configuration

Then I added this line to my shared Gradle config Showing Recent Messages A problem occurred configuring project ':shared'.

xcodeConfigurationToNativeBuildType["Staging"]=
         org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG

What went wrong: Task 'Debug' not found in project ':shared'.

anyway I have this warnings waringsws⚠️

Unable to detect Kotlin framework build type for CONFIGURATION=Staging Debug automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release

here is the gradle.kts

plugins {
    kotlin("multiplatform")
    kotlin("native.cocoapods")
    id("com.android.library")
}

version = "1.0"

kotlin {
    android()
    iosX64()
    iosArm64()
    iosSimulatorArm64()

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        ios.deploymentTarget = "12.1"
        podfile = project.file("../../bas-ios/Podfile")
        framework {
            baseName = "shared"
        }



         xcodeConfigurationToNativeBuildType["Staging"] = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG

    }
    
    sourceSets {
        val commonMain by getting
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting
        val androidTest by getting
        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
            iosSimulatorArm64Main.dependsOn(this)
        }
        val iosX64Test by getting
        val iosArm64Test by getting
        val iosSimulatorArm64Test by getting
        val iosTest by creating {
            dependsOn(commonTest)
            iosX64Test.dependsOn(this)
            iosArm64Test.dependsOn(this)
            iosSimulatorArm64Test.dependsOn(this)
        }
    }
}

android {
    compileSdk = 32
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdk = 24
        targetSdk = 32
    }
}
ASA
  • 371
  • 1
  • 3
  • 11
  • Please extend the question with the complete build.gradle.kts file appearance. It might be important where exactly do you add the `xcodeConfigurationToNativeBuildType`. – Artyom Degtyarev Apr 04 '22 at 13:46
  • 1
    @ArtyomDegtyarev I added complete build.gradle.kts to question – ASA Apr 05 '22 at 06:46
  • Maybe your Xcode configuration contains spaces? We've had a report about that some time ago: [KT-48771](https://youtrack.jetbrains.com/issue/KT-48771). The problem should be fixed in Kotlin 1.6.20, so please give it a try and let the developers know about any problems by adding a comment there. – Artyom Degtyarev Apr 05 '22 at 07:46

1 Answers1

0

thanks to @ArtyomDegtyarev , this problem when you Xcode configuration contains space like "Debug paid"

this will no work

xcodeConfigurationToNativeBuildType["Debug paid"] = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG

Sol : update to kotlin 1.6 remove space from xcode configuration["Debug_paid"]

ASA
  • 371
  • 1
  • 3
  • 11