【发布时间】:2023-03-11 10:20:02
【问题描述】:
只有当我混淆我的应用程序时,我才会收到以下错误:
com.google.firebase.database.DatabaseException: Found two getters or fields with conflicting case sensitivity for property: data`
这适用于以小写字母开头但存储在 Firebase 中以大写字母开头的类属性 - 例如val data 用 @PropertyName("Data") 注释的地方
有两个 firebase 依赖模块(firebase-database 和 firebase-firestore)都包含@PropertyName,当我更改我的类导入时:
import com.google.firebase.database.PropertyName
到
import com.google.firebase.firestore.PropertyName
然后崩溃消失,但未获取数据。
我不允许分享数据库详细信息,但模型具有以下结构:
import com...ResponseBase
import com.google.firebase.database.IgnoreExtraProperties
import com.google.firebase.database.PropertyName
@IgnoreExtraProperties
data class TxResponse constructor(
@PropertyName("Data")
val data: Data = Data(),
@PropertyName("AnId")
val anId: String = "",
@PropertyName("AResult")
val aResult: String = "",
@PropertyName("moreData")
val moreData: MoreData = MoreData()
) : ResponseBase()
@IgnoreExtraProperties
data class Data constructor(
@PropertyName("SomeId")
val someId: String = "",
@PropertyName("Label")
val label: String = "",
...
)
@IgnoreExtraProperties
data class MoreData(
@PropertyName("Code")
val code: Long = 0
)
仅作为背景,
我是keeping 模型和 firebase 类。我使用的是 firebase-firestore 22.0.0 版和 firebase-database-ktx 19.5.1 版。使用最新版本并不能解决问题。不幸的是,我无法更改数据库。
任何帮助都将非常感激!
【问题讨论】:
-
请编辑您的问题并将您的数据库结构添加为 JSON 文件或至少是屏幕截图。还请添加您的模型类的内容。
标签: android firebase firebase-realtime-database obfuscation android-r8