Home > Software engineering >  com.google.firebase.database.DatabaseException: Failed to convert a value of type java.lang.String t
com.google.firebase.database.DatabaseException: Failed to convert a value of type java.lang.String t

Time:01-06

I am adding Person name(String) and age(int) to the Firebase. But while retrieving data from Firebase I am facing this error.

enter image description here

See the double quotes ""? That makes 20 a String and not a number.

To solve this, you have to change the type of the age field to be number (without double quotes) and your problem will be solved. Doing that, your code may also remain untouched.

  •  Tags:  
  • Related