GitLiveApp / firebase-kotlin-sdk

A Kotlin-first SDK for Firebase
https://gitliveapp.github.io/firebase-kotlin-sdk/
Apache License 2.0
1.17k stars 155 forks source link

unable to build when using dev.gitlive:firebase-auth dependency #390

Closed sacketty closed 1 year ago

sacketty commented 1 year ago

Task :shared:linkDebugFrameworkIosX64 FAILED error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1. output: ld: framework not found FirebaseAuth error: Compilation finished with errors

FAILURE: Build failed with an exception.

BUILD FAILED in 8s 2 actionable tasks: 1 executed, 1 up-to-date

Here is an example project that demonstrates the issue: https://github.com/iamthearm/FirebaseKMMTest

RomeuG commented 1 year ago

Same happens to me, but for firebase-config.

EDIT:

I have tried many things I've found in this repo and in the original firebase-sdk-ios repo:

Nothing worked.

sacketty commented 1 year ago

Ok I managed to build by modifying the shares build gradle file. I just added cocoapods.framework.isStatic to true As per the file below.

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

@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) kotlin { targetHierarchy.default()

android {
    compilations.all {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
}
iosX64()
iosArm64()
iosSimulatorArm64()

cocoapods {
    summary = "Some description for the Shared Module"
    homepage = "Link to the Shared Module homepage"
    version = "1.0"
    ios.deploymentTarget = "14.1"
    podfile = project.file("../iosApp/Podfile")
    framework {
        baseName = "shared"
        isStatic = true // TODO setting this true solves this err --> ld: framework not found FirebaseAuth
    }
}

sourceSets {
    val commonMain by getting {
        dependencies {
            //put your multiplatform dependencies here
            // Firebase
            implementation("dev.gitlive:firebase-auth:1.8.1")
        }
    }
    val commonTest by getting {
        dependencies {
            implementation(kotlin("test"))
        }
    }
}

}

android { namespace = "com.brentsys.dev.myapplication" compileSdk = 33 defaultConfig { minSdk = 24 } `

RomeuG commented 1 year ago

Why would I use isStatic anyways? What if the iOS app already imports firebase? There will be conflicts because of the redefinition of the Firebase libs.