I am trying to retrieve my user details from the /User/ tree i have in Firebase. I have the following User object :
public class User {
private String
I have faced this in kotlin with firebase realtime database and solve it by this solution
For Kotlin, if you're using data class like below for firebase,
data class UserModel(
var UserName: String,
var UserType: Int
)
then you'll get an error like
com.google.firebase.database.DatabaseException: UserModel does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped.
So for this, you need to initialize its values.
data class UserModel(
var UserName: String = "",
var UserType: Int = 0
)