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

I have this error after i installed version 1.8.1 and i want to use Timestamp. Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class dev.gitlive.firebase.firestore.TimestampSerializer, unresolved supertypes: dev.gitlive.firebase.SpecialValueSerializer #392

Closed Lucian2001 closed 1 year ago

Lucian2001 commented 1 year ago

I have a multiplatform project and i am using firestore.

I have this error after i installed version 1.8.1 and i want to use Timestamp.

Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class dev.gitlive.firebase.firestore.TimestampSerializer, unresolved supertypes: dev.gitlive.firebase.SpecialValueSerializer.

this is my build.gradle from the shared project

`plugins { kotlin("multiplatform") kotlin("native.cocoapods") id("com.android.library") kotlin("plugin.serialization") id("com.rickclephas.kmp.nativecoroutines") }

kotlin.sourceSets.all { languageSettings.optIn("kotlin.experimental.ExperimentalObjCName") }

kotlin { 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 = "15.0"
    podfile = project.file("../TabookIos/Podfile")
    framework {
        baseName = "shared"
        isStatic = true
    }

    xcodeConfigurationToNativeBuildType["Debug Development"] =
        org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG
    xcodeConfigurationToNativeBuildType["Debug Stage"] =
        org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG
    xcodeConfigurationToNativeBuildType["Release Development"] =
        org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.RELEASE
    xcodeConfigurationToNativeBuildType["Release Stage"] =
        org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.RELEASE
    xcodeConfigurationToNativeBuildType["Release Production"] =
        org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.RELEASE
}

sourceSets {
    val ktorVersion = "2.2.3"

    val commonMain by getting {
        dependencies {
            // Firebase
            implementation("dev.gitlive:firebase-auth:1.8.1")
            implementation("dev.gitlive:firebase-firestore:1.8.1")
            implementation("dev.gitlive:firebase-functions:1.8.1")

            // Ktor
            implementation("io.ktor:ktor-client-core:$ktorVersion")
            implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")

            // Serialization
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")

            // Dependency Injection
            implementation("org.kodein.di:kodein-di:7.18.0")

            // Time
            implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
        }
    }
    val androidMain by getting {
        dependencies {
            implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
        }
    }

    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-darwin:$ktorVersion")
        }
    }
}

}

android { namespace = "" compileSdk = 33 defaultConfig { minSdk = 28 targetSdk = 33 } }

`

How can i solve this problem?

Michona commented 1 year ago

One solution is to add dependency to dev.gitlive:firebase-common:1.8.1 in your commonMain, so that the SpecialValueSerializer can be resolved.

Hope that helps.

nbransby commented 1 year ago

I believe this has been fixed in 1.9.0 - please reopen if something is missing