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

Devendra Patel

06/29/2021, 8:24 PM
Hello there, I am trying to use
mParticle
library cocoapod in Kotlin Multiplatform project but am seeing following error
Copy code
Execution failed for task ':shared:cinteropMParticle-Apple-SDKIos'.
> Process 'command '/Applications/Android <http://Studio.app/Contents/jre/jdk/Contents/Home/bin/java|Studio.app/Contents/jre/jdk/Contents/Home/bin/java>'' finished with non-zero exit value 1

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':shared:cinteropMParticle-Apple-SDKIos'.
....
Does anyone have an insight on how I can fix this issue? Thanks
This is how my shared module's build.gradle.kts looks like
Copy code
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

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

    cocoapods {
        // Configure fields required by CocoaPods.
        summary = "Some description for a Kotlin/Native module"
        homepage = "<https://www.mparticle.com/>"

        // You can change the name of the produced framework.
        // By default, it is the name of the Gradle project.
        frameworkName = "shared"

        ios.deploymentTarget = "13.0"
        pod ("mParticle-Apple-SDK") {
            version = "~> 8"
        }
    }

    val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
        if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
            ::iosArm64
        else
            ::iosX64

    iosTarget("ios") {}

    sourceSets {
        val commonMain by getting
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
        val androidMain by getting
        val androidTest by getting {
            dependencies {
                implementation(kotlin("test-junit"))
                implementation("junit:junit:4.13.2")
            }
        }
        val iosMain by getting
        val iosTest by getting
    }
}

android {
    compileSdkVersion(30)
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdkVersion(24)
        targetSdkVersion(30)
    }
}
Looks like I am getting
module not found
error
Copy code
Showing All Messages
Exception in thread "main" java.lang.Error: /var/folders/f0/lmpyzdr91js7qn9r2_d7mz900000gq/T/16306153464979317442.m:1:9: fatal error: module 'mParticle' not found