我在发布模式下运行应用程序时遇到问题。 正确返回了我的Workshop对象的所有数据,但“地图用户”列出了。相同的代码在调试模式下运行没有任何问题。
我通过快照解析器获得了我的用户列表,如下所示:
FirebaseRecyclerOptions<Workshop> options =
new FirebaseRecyclerOptions.Builder<Workshop>()
.setQuery(query, new SnapshotParser<Workshop>() {
@NonNull
@Override
public Workshop parseSnapshot(@NonNull DataSnapshot snapshot) {
GenericTypeIndicator<Workshop> t = new GenericTypeIndicator<Workshop>() {
};
Workshop workshop = snapshot.getValue(t);
return workshop;
}
})
.build();
这是我的Workshop模块:
@Keep
public class Workshop implements Serializable {
private String date;
private String time;
private String description;
private String name;
private String address;
private String city;
Map<String, User> users = new HashMap<>();
// empty constructor for firebase
public Workshop() {
}
public Workshop(String date, String time, String description, String name, String address, String city,
Map<String, User> users) {
this.date = date;
this.time = time;
this.description = description;
this.name = name;
this.address = address;
this.city = city;
this.users = users;
}
public Workshop(String date, String time, String description, String name, String address, String city) {
this.date = date;
this.time = time;
this.description = description;
this.name = name;
this.address = address;
this.city = city;
}