【发布时间】:2016-07-15 20:09:04
【问题描述】:
我有以下代码:
public class TestClass {
public ArrayList<ObjectTypes> list = new ArrayList<>();
public TestClass(){
list.add(ObjectTypes.type1);
}
}
public enum ObjectTypes {
type1,
type2,
type3,
type4,
}
fb.child("Test").setValue(new TestClass());
其中 fb 是 DatabaseReference。
运行代码时应用程序崩溃并出现以下错误:
com.google.firebase.database.DatabaseException:没有属性 在课堂上找到序列化 对象类型
旧版 Firebase 中没有出现此问题。
【问题讨论】:
-
Firebase 2.x 依赖于 Jackson 的 JSON 序列化。我们的目标是获得原生支持的主要用例(在您的 APK 大小中占用更小的空间)。如果您发现需要(尚)不支持的用例,您仍然可以使用 Jackson。见stackoverflow.com/questions/37547399/…
标签: android serialization enums firebase firebase-realtime-database