I used kotlin lazy property in serializeable class. It works well in debug mode build, but crashed in release build (with proguard).
I've solve this issue by adding below rule to proguard settings.
Maybe better exclude lazy property from serilization (add
@Transient
annotation)
s
sewon
01/29/2019, 8:43 AM
@gildor Yes, I agree. It can help avoid that problem. But every developers should keep that in mind, so that problem could be potential source of error.
g
gildor
01/29/2019, 8:44 AM
Yes, and the main source of those problems is
java.io.Serializable
which should be used really carefully
👍 1
gildor
01/29/2019, 8:46 AM
kotlin delegate is not something unique, you have all those problems in many other cases if you just add Serializable to class
s
sewon
01/29/2019, 8:47 AM
Yes.
Parcelable
could be another good solution. I think it does not have all these kind of problems.
g
gildor
01/29/2019, 8:49 AM
At least Parcelable is very explicit about implementation, doesn’t work with Serializable magic