我做了一个聊天应用程序,它持续显示错误

时间:2017-02-11 09:37:01

标签: android firebase firebase-authentication

E / AndroidRuntime:致命异常:主要                                                                                           流程:com.google.firebase.udacity.friendlychat,PID:28266                                                                                           com.google.firebase.database.DatabaseException:类com.google.firebase.udacity.friendlychat.FriendlyMessage缺少一个没有参数的构造函数                                                                                               在com.google.android.gms.internal.zzbqi $ zza.zze(未知来源)                                                                                               在com.google.android.gms.internal.zzbqi $ zza.zzaG(未知来源)                                                                                               在com.google.android.gms.internal.zzbqi.zze(未知来源)                                                                                               在com.google.android.gms.internal.zzbqi.zzb(未知来源)                                                                                               在com.google.android.gms.internal.zzbqi.zza(未知来源)                                                                                               在com.google.firebase.database.DataSnapshot.getValue(未知来源)                                                                                               在com.google.firebase.udacity.friendlychat.MainActivity $ 6.onChildAdded(MainActivity.java:290)                                                                                               在com.google.android.gms.internal.zzblz.zza(未知来源)                                                                                               在com.google.android.gms.internal.zzbnz.zzYj(未知来源)                                                                                               在com.google.android.gms.internal.zzboc $ 1.run(未知来源)                                                                                               在android.os.Handler.handleCallback(Handler.java:751)                                                                                               在android.os.Handler.dispatchMessage(Handler.java:95)                                                                                               在android.os.Looper.loop(Looper.java:154)                                                                                               在android.app.ActivityThread.main(ActivityThread.java:6688)                                                                                               at java.lang.reflect.Method.invoke(Native Method)                                                                                               在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1468)                                                                                               在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

1 个答案:

答案 0 :(得分:2)

正如您的错误消息所示:

com.google.firebase.udacity.friendlychat.FriendlyMessage is missing a constructor with no arguments 

所以你必须在FriendlyMessage类中缺少默认构造函数(没有参数的构造函数)