firebase-kotlin-sdk
firebase-kotlin-sdk copied to clipboard
Facing issue while trying to read collection from firestore
I am facing ClassNotFoundException while reading collection. I have added all the needed dependencies in gradle file. I did the signin process with custom token.
Caused by: java.lang.ClassNotFoundException: Didn't find class "dev.gitlive.firebase.DecodersKt"
Below is the shared module gradle dependencies
val commonMain by getting { dependencies { implementation(libs.kotlinx.coroutines.core) implementation(libs.ktor.client.core) implementation(libs.ktor.client.content.negotiation) implementation(libs.ktor.serialization.kotlinx.json) implementation(libs.ktor.client.logging) implementation(libs.koin.core) implementation(libs.sql.coroutines.extensions) implementation(libs.firebase.firestore) implementation(libs.firebase.common) implementation(libs.kotlinx.serialization.json) implementation(libs.firebase.auth) } }
These are android module denpencies.
dependencies { implementation(projects.shared) implementation(libs.compose.ui) implementation(libs.compose.ui.tooling.preview) implementation(libs.compose.material3) implementation(libs.androidx.activity.compose) implementation(libs.androidx.appcompat) implementation(libs.androidx.constraintlayout) implementation(libs.material) implementation(libs.androidx.lifecycle.livedata.ktx) implementation(libs.androidx.lifecycle.viewmodel.ktx) implementation(libs.androidx.navigation.fragment.ktx) implementation(libs.androidx.navigation.ui.ktx) debugImplementation(libs.compose.ui.tooling) implementation(libs.koin.android) implementation(platform(libs.google.firebase.bom)) implementation(libs.firebase.common.ktx) implementation(libs.google.firebase.common) }
Please suggest if anyone faced this issue or some workaround to fix this issue.
@Daeda88 any clue on this?
Below are lines of code I am trying to read collection after calling signInWithCustomToken() -
`1. val tokenResponse = auth.signInWithCustomToken(customtoken) val response = firestore.collection("collectionPath") .document("documentPath").get().data<MyDataClass>(MyDataClass.serializer()) println("response... $response")
- val tokenResponse = auth.signInWithCustomToken(customtoken) val response = firestore.collection("collectionPath") .document("documentPath").get().data<MyDataClass>(ServerTimestampBehavior.ESTIMATE) println("response... $response")`
In both cases I am getting same exception -
Caused by: java.lang.ClassNotFoundException: Didn't find class "dev.gitlive.firebase.DecodersKt"
Please let me know if any more input needed here. Is this DecodersKT an internal class and not exposed publicly. Please suggest for any alternate solution to overcome this issue.
DecodersKt has been moved to dev.gitlive.firebase.internal, so the fact your logging is trying to get it from dev.gitlive.firebase indicates to me that something is wrong in your setup. Are you sure you use a consistent version of the sdk for all of your modules?