Closed LNdame closed 4 years ago
What object are you annotating with @Parcel
?
Different person, same project :) I have done some digging and I am pretty sure this is our culprit.
@Parcel
public class DataManagerCachedDataImpl extends ViewModel
implements DataManagerCachedData {
Do you have some insight into a workaround we could use?
Hi @maraisf! Parceler will attempt to serialize everything, including data members of the inherited classes. I'd recommend avoiding extending things like the ViewModel
(which probably has a `Map<String, Object> field) if possible.
Thanks for the quick response and guidance! 👍
Sure @maraisf, does this solve your issue?
Removing the extends ViewModel
does infact resolve the error above. Thanks.
Cool. You could also use the analyze parameter include or exclude ViewModel
from the generated Parcelable
, but, generally, I'd recommend keeping the type hierarchy limited.
Description
Bumping from androidx.lifecycle:lifecycle-viewmodel:2.0.0 to androidx.lifecycle:lifecycle-viewmodel:2.2.0 casuse the following issue
Parceler: Unable to find read/write generator for type java.util.Map<java.lang.String, java.lang.Object> for androidx.lifecycle.ViewModel.mBagOfTags
mBagsofTags is a private field that is in the lifecycle.ViewModel
private final Map<String, Object> mBagOfTags = new HashMap<>();
Resolution attempt
Creating a custom converter for the field was unfruitful as the field is private