firebase-kotlin-sdk icon indicating copy to clipboard operation
firebase-kotlin-sdk copied to clipboard

Running iOS tests fails with linker error

Open tbgardner opened this issue 3 years ago • 1 comments
trafficstars

Hello

I'm working on a KMM project and I have an issue with running the iOS unit tests for the class that uses the Remote Config library.

I'm only using the Remote Config library from the Firebase Kotlin SDK and I'm exporting the shared library to iOS via a static cocoapod.

The error I'm getting is:

Task :shared:linkDebugTestIosX64 e: /Applications/Xcode13.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors The /Applications/Xcode13.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1. output: ld: framework not found FirebaseABTesting

I've tried the approach described here KT-44857 Link cocoapods frameworks with iosTest binary, which is to link the required framework via linker options, but I cannot find the path for the FirebaseABTesting.framework in order to pass it as a linker flag.

Any ideas?

This is my shared/build.gradle:

val ktorVersion = "2.0.2" val coroutinesVersion = "1.6.1" val serializationVersion = "1.3.1" val koinVersion = "3.1.6" val multiplatformSettings = "0.9" val logbackVersion = "1.2.5" val statelyConcurrencyVersion = "1.2.2" val statelyCommonVersion = "1.2.0" val mockativeVersion = "1.1.4" val realmVersion = "0.11.1" val firebaseKtxVersion = "1.6.1"

plugins { kotlin("multiplatform") kotlin("native.cocoapods") kotlin("plugin.serialization") version "1.6.20" id("com.android.library") id("kotlin-android-extensions") id("maven-publish") id("com.google.devtools.ksp") version "1.6.21-1.0.5" id("io.realm.kotlin") }

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 = "14.1"
    podfile = project.file("../iosApp/Podfile")
    framework {
        baseName = "shared"
        isStatic = true
        embedBitcode(org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode.BITCODE)
    }
}

sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
                implementation("io.ktor:ktor-client-core:$ktorVersion")
                implementation("io.ktor:ktor-client-logging:$ktorVersion")
                implementation("io.ktor:ktor-client-auth:$ktorVersion")
                implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
                implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
                implementation("io.insert-koin:koin-core:$koinVersion")
                implementation("com.russhwolf:multiplatform-settings:$multiplatformSettings")
                implementation("ch.qos.logback:logback-classic:$logbackVersion")
                implementation("co.touchlab:stately-concurrency:$statelyConcurrencyVersion")
                implementation("co.touchlab:stately-common:$statelyCommonVersion")
                implementation("io.realm.kotlin:library-base:$realmVersion")
                implementation(	"dev.gitlive:firebase-config:$firebaseKtxVersion")
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
                implementation("io.insert-koin:koin-test:$koinVersion")
                implementation("io.mockative:mockative:$mockativeVersion")
            }
        }
        val androidMain by getting {
            dependencies {
                implementation("com.google.android.material:material:1.2.1")
                implementation("io.ktor:ktor-client-android:$ktorVersion")
                implementation("com.google.code.gson:gson:2.8.6")
            }
        }
        val androidTest by getting {
            dependencies {
                implementation(kotlin("test-junit"))
                implementation("junit:junit:4.13")
            }
        }
        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)

            dependencies {
                implementation("io.ktor:ktor-client-ios:$ktorVersion")
            }
        }

        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)
        }
    }

}

dependencies {
    implementation("androidx.security:security-crypto:1.0.0")
    implementation("com.google.firebase:firebase-common-ktx:20.1.0")
    implementation("com.google.firebase:firebase-storage-ktx:20.0.1")
    ksp("io.mockative:mockative-processor:$mockativeVersion")
}

android { compileSdk = 31 sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") defaultConfig { minSdk = 24 targetSdk = 31 } }

tbgardner avatar Jun 15 '22 23:06 tbgardner

try release 1.8.0

Reedyuk avatar Apr 05 '23 10:04 Reedyuk