好吧,我是Firebase开发的新手,我正在尝试将数据插入到已连接到我的android studio项目的应用数据库中。但是,在单击将文本添加到数据库的按钮后,我得到了这个堆栈跟踪:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.xxxxx, PID: 13243
com.google.firebase.database.DatabaseException: Found conflicting getters for name: isChangingConfigurations
at com.google.android.gms.internal.zzbqi$zza.<init>(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzi(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaw(Unknown Source)
at com.google.firebase.database.DatabaseReference.zza(Unknown Source)
at com.google.firebase.database.DatabaseReference.setValue(Unknown Source)
at com.xxx.xxxxx.MainActivity$1.onClick(MainActivity.java:85)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
MainActivity
代码行如果在又名第85行爆发,则如下:
mDatabase.child("users").child(mUserId).child("items").push().child("title").setValue(new ChatMessage(input.getText().toString(), mFirebaseAuth.getCurrentUser().getDisplayName()));
如果有人能够提出一个很好的快速解决方案,我将不胜感激。 Google Firebase团队前来救援!
修改
根据@Frank的请求,这是我在setValue()中使用的ChatMessage的java类:
package com.xxx.xxxxx;
import android.support.v7.app.AppCompatActivity;
import com.google.firebase.database.IgnoreExtraProperties;
import java.util.Date;
/**
* Created by sahir on 12/4/2016.
*/
@IgnoreExtraProperties
public class ChatMessage extends AppCompatActivity {
public String messageText;
public String messageUser;
public long messageTime;
public ChatMessage(){}
public ChatMessage(String messageText, String messageUser) {
this.messageText = messageText;
this.messageUser = messageUser;
// Initialize to current time
messageTime = new Date().getTime();
}
public String getMessageText() { return messageText; }
public String getMessageUser() { return messageUser; }
public long getMessageTime() { return messageTime; }
}//close ChatMessage