When I unparcel my Kotlin data object
class, a Log.wtf
is called internally somewhere alerting me that it expected a certain amount of bytes, however some of those were not found.
Unparcelling of MyClass(placeholder=1, placeholder2=2, string=Hello, there!, attachments=[])
of type VAL_PARCELABLE consumed 3612 bytes, but 3616 expected.
(not exact log, as the class contains quite a lot of information)
I'm unsure why this message keeps logging, and it seems to change each time I re-open my app? That exact same Parcel, with the exact same details, now says the error consumed 2068 bytes, but 3436 expected.
(notice it says 3436
instead of 3496
). Sometimes, it'll say consumed 3612 bytes, but 3616 expected
.
This is very strange and is quite annoying! How do I solve this issue that has not appeared at all on the internet (as far as I've seen)?
consumed 3612 bytes, but 3616 expected
means that you aren't actually reading in everything you've written - you've 'consumed' (e.g., read in) only 3,612 bytes of the 3,616 bytes that you wrote out.
Double check your Parcelable implementation to ensure that the writing and reading are perfectly symmetrical in all cases.