I received the error and I do not know what else to do:
Error
01 19: 15: 53,568 21966 21966 D AndroidRuntime
Shutting down VM 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
FATAL EXCEPTION: main 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime Process: com.mycompany.parcelsdecartao, PID: 21966 09-01 19: 15: 53,574 21966 21966 And AndroidRuntime
com.firebase.client.FirebaseException: Failed to bounce to type 09-01 19: 15: 53.574 21966 21966 E AndroidRuntime
at com.firebase.client.DataSnapshot.getValue (DataSnapshot.java:185) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.mycompany.parameters.MainActivity $ 100000001 $ 100000000.onDataChange (MainActivity.java:71) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.firebase.client.core.ValueEventRegistration.fireEvent (ValueEventRegistration.java:45) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.firebase.client.core.view.DataEvent.fire (DataEvent.java:45) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.firebase.client.core.view.EventRaiser $ 1.run (EventRaiser.java:38) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at android.os.Handler.handleCallback (Handler.java:746) 09-01 19: 15: 53.574 21966 21966 E AndroidRuntime
at android.os.Handler.dispatchMessage (Handler.java:95) 09-01 19: 15: 53.574 21966 21966 E AndroidRuntime
at android.os.Looper.loop (Looper.java:148) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime at android.app.ActivityThread.main (ActivityThread.java:5443) 09-01 19: 15: 53.574 21966 21966 E AndroidRuntime
at java.lang.reflect.Method.invoke (Native Method) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:728) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618) 09-01 19: 15: 53.574 21966 21966 E AndroidRuntime
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "-KszUQXLaFg5qrTIXqAs" (class com.mycompany.parcelsdecartao.model.Person), not marked as ignorable (3 known properties:, "uid", "name", "address")) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime at [Source: java.io.StringReader@a6ef5a3; line: 1, column: 56] (through reference chain: com.mycompany.parameters.model.Person ["- KszUQXLaFg5qrTIXqAs"]) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty (DeserializationContext.java:555) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty (StdDeserializer.java:708) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty (BeanDeserializerBase.java:1160) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject (BeanDeserializer.java:315) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (BeanDeserializer.java:121) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose (ObjectMapper.java:2888) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.fasterxml.jackson.databind.ObjectMapper.readValue (ObjectMapper.java:2034) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
at com.firebase.client.DataSnapshot.getValue (DataSnapshot.java:183) 09-01 19: 15: 53,574 21966 21966 E AndroidRuntime
... 11 more
Object
package com.mycompany.parcelasdecartao.model;
import com.google.firebase.database.*;
/**
* Created by Belal on 2/23/2016.
*/ //@JsonIgnoreProperties @IgnoreExtraProperties public class Person { //name and address string
private String name; private String address; @Exclude private String uid;
public Person() { /*Blank default constructor essential for Firebase*/ } //Getters and setters public String getUid(){ return uid; }
public void setUid(String uId) { this.uid = uId; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getAddress() { return address; }
public void setAddress(String address) { this.address = address; }
}
Código buttonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {
String personId; //Creating firebase object Firebase ref = new Firebase(Config.FIREBASE_URL);
//Getting values to store String name = editTextName.getText().toString().trim(); String address = editTextAddress.getText().toString().trim();
//Creating Person object Person person = new Person();
personId = ref.push().getKey();
//Adding values person.setName(name); person.setAddress(address); //person.setUid(personId);
//Storing values to firebase //ref.child("Person").setValue(person);
ref.child("Person").child(personId).setValue(person);
//Value event listener for realtime data update ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { for (DataSnapshot postSnapshot : snapshot.getChildren()) { //Getting the data from snapshot Person person = postSnapshot.getValue(Person.class);
//Adding it to a string String string = "Name: "+person.getName()+"\nAddress: "+person.getAddress()+"\n\n";
//Displaying it on textview textViewPersons.setText(string); } }
@Override public void onCancelled(FirebaseError firebaseError) { System.out.println("The read failed: " + firebaseError.getMessage()); } });
} });
}