Android Kotlin firebase.database.DatabaseException: No properties to serialize found on class

前端 未结 3 1935
北荒
北荒 2020-12-22 13:44

I have followed the advice of other SO solution: 1. Make my class Serializeable 2. Have a default constructor for Firebase 3. Update my proguard rules (Not sure about this o

3条回答
  •  梦毁少年i
    2020-12-22 14:00

    Solved, even in Kotlin it seems the variables had to be explicitly Public.

    import java.io.Serializable
    
    /**
     * Created by fyi2 on 2/21/18.
     */
    class User :Serializable {
        public var displayName:String=""
        public var email:String=""
        public  var photoUrl:String=""
        public var userId:String=""
    
        constructor() {}
    
        constructor(displayName: String, email: String, photoUrl: String, userId: String) {
            this.displayName = displayName
            this.email = email
            this.photoUrl = photoUrl
            this.userId = userId
        }
    
    }
    

    Once that was modified, the rest worked as is.

提交回复
热议问题