Firebase DatabaseException: Failed to convert value of type java.lang.Long to String

The problem is that you are creating the property "mobile_phone" as a String and on Firebase it is a Long type.

Change:

private String mobile_phone;

To:

private Long mobile_phone;

Problems

  1. If you are adding values in firebase database manually, the values will be in long data type; for example:

enter image description here

  1. If you are adding values by commands, the values will be saved in the database as string.

Solution:

When you are getting the values from database, save the values in default data type. Then, when you want to reuse the value change it into the string by using the toString() method.


Check if your getters and class/model are equals in firebase database.

When method .getValue() retrieve datas it compare if signatures are same.

example:
In class we have a getLong
enter image description here

for get value retrieve in firebase database enter image description here