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
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.
you can easily use a data class, it already comes with an empty constructor ect.
@IgnoreExtraProperties
data class User(
var displayName: String? = null,
var email: String? = null,
var photoUrl : String? = null,
var userId: String? = null
)
If you got the issue on release apk then Do like this in your proguard file
-keepattributes Signature
-keepclassmembers class com.yourcompany.models.** {
*;
}