0

Alright, I am fairly new to the Firebase development and I am trying to insert a data into the app database that I have connected to my android studio project. However, I get this stack-trace after clicking a button that adds the text to the database:

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)

And the MainActivity code line that if bursts on aka line 85 is as follows:

mDatabase.child("users").child(mUserId).child("items").push().child("title").setValue(new ChatMessage(input.getText().toString(), mFirebaseAuth.getCurrentUser().getDisplayName()));

Would appreciate if anyone can come up with a nice and quick solution to this problem. Google Firebase team come to rescue!

EDIT

Upon @Frank's request, this is the java class of ChatMessage that I am using inside my setValue() :

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
Sahir
  • 329
  • 1
  • 2
  • 9

1 Answers1

0

I found the problem. I was foolish enough to remove the following import after making the java class (ChatMessage) independent of acting like a java activity. And now I can pass my objects to the setValue without any problem!

import android.support.v7.app.AppCompatActivity;

And yes also this must be removed:

extends AppCompatActivity
Sahir
  • 329
  • 1
  • 2
  • 9