我收到以下错误:
Could not deserialize object. Generic wildcard types are not supported (found in field
m1(Map<String,Any>).someStringInM1(String)
)
此错误由以下行生成(我使用的是 Firestore 的 Android SDK):
task.result.toObjects(SomeClass::class.java)
我在其中尝试将结果映射到具有以下构造函数的自定义类的列表:
constructor(s1: String, s2: String, d1: Double, m1: Map<String, Any>, dr1: DocumentReference, i1: Int, d2: Double) {
this.s1 = s1
this.s2 = s2
this.d1 = d1
this.m1 = m1
this.dr1 = dr1
this.i1 = i1
this.d2 = d2
}
最佳答案
在release notes对于 Firebase SDK,它提到了版本 11.6.0:
Feature: Added support for deserializing field types with wildcard generic parameters (e.g. kotlin.Map).
听起来您应该将客户端库升级到 11.6.0。
关于android - 不支持通用通配符类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47190759/