【发布时间】:2021-03-09 18:01:46
【问题描述】:
这是我的模型类
@Parcel
data class ClientModel(
var name: String? = "",
var phone: String? = "",
var princpalAddresse: String? = "",
var homeAddresse: String? = "",
var travailleAddresse: String? = "",
var email: String? = "",
var userToken: String? = "",
var principalAddresseCoords: Pair<Double, Double>? = null,
var homeAddresseCoords: Pair<Double, Double>?= null,
var workAddresseCoords: Pair<Double, Double>? = null,
)
我的 proGuard 文件保留类:
-keep class com.olivier.oplivre.models.ClientModel
但是!当我尝试使用 singleValueEventListener 获取快照时,由于 Pair
val utilisationInfo = snapshot.getValue(ClientModel::class.java) //todo CRASH
例外:
com.google.firebase.database.DatabaseException: Class kotlin.Pair does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped.
数据库结构:
【问题讨论】:
标签: android firebase kotlin firebase-realtime-database