I tried to look at similar questions but they are of no use for me.
I have a class:
data class TextMessage(val text: String,
override val time: Date,
override val senderId: String,
override val isText: Boolean = true)
: Message{
constructor() : this("", Date(0), "") }
Then I try to store an instance of it in Firestore:
fun sendTextMessage(message: TextMessage, channelId: String) {
chatChannelsCollectionRef.document(channelId)
.collection("messages")
.add(message)
}
For some reason whenever I call sendTextMessage
I get this exception:
java.lang.RuntimeException: Found conflicting getters for name isText on class com.resocoder.firemessageprep.model.TextMessage
at com.google.android.gms.internal.zzevb$zza.<init>(Unknown Source:191)
at com.google.android.gms.internal.zzevb.zzg(Unknown Source:12)
at com.google.android.gms.internal.zzevb.zza(Unknown Source:285)
at com.google.android.gms.internal.zzevb.zzbw(Unknown Source:2)
at com.google.firebase.firestore.zzk.zzcd(Unknown Source:36)
at com.google.firebase.firestore.CollectionReference.add(Unknown Source:5)
at com.resocoder.firemessageprep.util.FirestoreUtil.sendTextMessage(FirestoreUtil.kt:138)
at com.resocoder.firemessageprep.ChatActivity$onCreate$1$2.onClick(ChatActivity.kt:52)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
It doesn't make sense. I know that TextMessage implements an interface which has a property isText but that shouldn't be the cause... right?
Thanks for reading this far!