Firebase" FATAL EXCEPTION:用户缺少一个没有参数的构造函数"

时间:2017-11-17 02:05:23

标签: java android firebase

我正在制作一个应用程序,允许客户预约约会,每次我运行应用程序时,它都会崩溃并说:

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.sakaaz.sakaaz, PID: 22041
                  com.google.firebase.database.DatabaseException: Class edmt.dev.androidsakaaz.model.User is missing a constructor with no arguments
                      at com.google.android.gms.internal.zzbtg$zza.zze(Unknown Source)
                      at com.google.android.gms.internal.zzbtg$zza.zzaH(Unknown Source)
                      at com.google.android.gms.internal.zzbtg.zze(Unknown Source)
                      at com.google.android.gms.internal.zzbtg.zzb(Unknown Source)
                      at com.google.android.gms.internal.zzbtg.zza(Unknown Source)
                      at com.google.firebase.database.DataSnapshot.getValue(Unknown Source)
                      at edmt.dev.androidsakaaz.SignIn$1$1.onDataChange(SignIn.java:61)
                      at com.google.android.gms.internal.zzbpx.zza(Unknown Source)
                      at com.google.android.gms.internal.zzbqx.zzZS(Unknown Source)
                      at com.google.android.gms.internal.zzbra$1.run(Unknown Source)
                      at android.os.Handler.handleCallback(Handler.java:751)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6836)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'

代码没有任何错误,我对android很新,我不知道该怎么做。这就是我的user.java看起来像

public class User {
    private String Name;
    private String Password;

    public User(String name) {
        Name = name;
    }

    public User(String name, String password) {
        Name = name;
        Password = password;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public String getPassword() {
        return Password;
    }

    public void setPassword(String password) {
        Password = password;
    }


}

请帮忙!

0 个答案:

没有答案