https://kotlinlang.org logo
#android
Title
# android
d

dimsuz

01/25/2021, 12:08 PM
Hi! I have a custom parceler
Copy code
class StringSrcParceler : Parceler<StringSrc?>
Which I use like this:
Copy code
@Parcelize
@TypeParceler<StringSrc?, StringSrcParceler>
data class PermissionRequestFlowParams(
  val allowPostpone: Boolean,
  val forbidDismissWithMessage: StringSrc?,
) : Parcelable
At runtime this gives me an exception:
Copy code
java.lang.NoSuchFieldError: No static field INSTANCE of type Lru/kode/base/ui/core/resources
/StringSrcParceler; in class Lru/kode/base/ui/core/resources/StringSrcParceler
Full: https://pastebin.com/NYBEcgE1 What am I doing wrong?
y

Youssef Shoaib [MOD]

03/01/2021, 7:25 PM
I think it's expecting
StringSrcParceler
to be an
object
, and so define it as
object StringSrcParceler : Parceler<StringSrc?> { // Class code }
d

dimsuz

03/03/2021, 1:55 PM
Yes, thank you! I disovered this some time ago and forgot to mention this here. Was quite puzzled for some time, I guess error message could be clearer, something like "use object instead of class"
38 Views