1

I have class User which has additional info, but it is throwing:

com.google.firebase.database.DatabaseException: Serializing Collections is not supported, please use Lists instead

My code is:

User user = new User(Gender.valueOf(mGenderSpinner.getSelectedItem().toString()));
                            Log.d("GENDER", user.getGender().toString());
                            mFirebaseDatabase.getReference("Users")
                                    .child(mAuth.getCurrentUser().getUid())
                                    .setValue(user)

The question is how I can still set User.class value or this is not possible?

4

1 Answer 1

1

Value type ordering

  • Null values
  • Boolean values
  • Integer and floating-point values, sorted in numerical order
  • Date values
  • Text string values
  • Byte values
  • Cloud Firestore references
  • Geographical point values
  • Array values
  • Map values

com.google.firebase.database.DatabaseException: Serializing Collections is not supported, please use Lists instead

  • Above Exception show that you have unsupported Collections object on User class just change with one of above supported type ex. List<Type>.

Update

Thanks to Alex Mamo comment,

  • Above is Data Types is for Firebase Cloud Database, But Firebase Realtime Database as following.

  • Pass types that correspond to the available JSON types as follows:

  • String

  • Long

  • Double

  • Boolean

  • Map<String, Object>

  • List

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.