相关疑难解决方法(0)

Firebase在类上找不到要序列化的属性

我开始创建一个Firebase数据库.

我正在尝试为一个班级建模.一个非常简单的课程:

package com.glups.model;

import com.google.firebase.database.IgnoreExtraProperties;

@IgnoreExtraProperties
public class AlumnoFB {

    private String nombre;
    private String apellidos;
    private String telefono;
    private String email;
    private Boolean tieneWhatsapp;
    private Boolean tieneTelegram;
    private Boolean tieneHangouts;
    private Long formaPago;
    private Double ratioHora;
    private Double precioHora;
    private Double horasCompensadas;

    public AlumnoFB() {
        // Default constructor required for calls to DataSnapshot.getValue(User.class)
    }

    public AlumnoFB(String nombre,
                    String apellidos,
                    String telefono,
                    String email,
                    Boolean tieneWhatsapp,
                    Boolean tieneTelegram,
                    Boolean tieneHangouts,
                    Long formaPago,
                    Double ratioHora,
                    Double precioHora,
                    Double horasCompensadas) { …
Run Code Online (Sandbox Code Playgroud)

java android firebase firebase-realtime-database

70
推荐指数
3
解决办法
3万
查看次数

Firebase在发布模式下找不到与对象一起序列化的属性

我写了一个将实时位置数据推送到Firebase的方法:

private void writeNewMarker(int sessionType, String myUuid, String datetime, Location location) {
    locationToDB = new LocationFromAndroid();
    JSONObject jsonObjectCoords = new Coords(location.getLatitude() + "", location.getLongitude() + "", location.getAltitude() + "");
    locationToDB.setFinish("false");
    locationToDB.setLost("false");
    locationToDB.setCoords(jsonObjectCoords);
    locationToDB.setDistanceToGo("0");
    locationToDB.setHeading(location.getBearing() + "");
    locationToDB.setNauwkeurigheid(location.getAccuracy() + "");
    locationToDB.setSpeed(location.getSpeed() * 3.6 + "");
    locationToDB.setSpeed2(location.getSpeed() + "");
    locationToDB.setTimestamp(location.getTime() + "");
    locationToDB.setWp_user(myUuid);
    locationToDB.setSessionType(sessionType);
    locationToDB.setTitle(title);
    if(myUuid != null && datetime != null && locationToDB.getTitle() != null && !myUuid.isEmpty() && !datetime.isEmpty()) {
        databaseRef.child(myUuid + "-Android" + sessionType + datetime).setValue(locationToDB);
Run Code Online (Sandbox Code Playgroud)

当我在调试模式下构建应用程序时,它完全正常.但是,当我在Google Play的发布模式下构建它时,它会停止在此行上工作:

databaseRef.child(myUuid + …
Run Code Online (Sandbox Code Playgroud)

java android object release-mode firebase

6
推荐指数
1
解决办法
3185
查看次数

Firebase - 没有在类上找到的序列化属性

我有一个这样的课:

class dataModel {
    String id, name;
    Integer count;

    dataModel() {}
}
Run Code Online (Sandbox Code Playgroud)

我从Firebase添加数据.

mDatabase.addValueEventListener(mListener = new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            dataSet.add(dataSnapshot.getValue(dataModel.class));
            //...
        }
});
Run Code Online (Sandbox Code Playgroud)

当我将应用程序作为调试运行时,没有问题.但在它发布后,应用程序崩溃并出现错误:

com.google.firebase.database.DatabaseException: No properties to serialize found on class com.my.package.dataModel
Run Code Online (Sandbox Code Playgroud)

我有minifyEnabled 是的

java android firebase firebase-realtime-database

5
推荐指数
1
解决办法
6433
查看次数