我正在使用 Realm 和 Parceler,一切正常,但是当我启用 Proguard 时,我在执行以下操作时遇到错误:
Parcels.wrap(obj)
我收到以下错误:
org.parceler.ParcelerRuntimeException: Unable to find generated Parcelable class for io.realm.g, verify that your class is configured properly and that the Parcelable class io.realm.g$$Parcelable is generated by Parceler.
虽然我已经配置了 proguard 规则,例如:
##---------------Begin: proguard configuration for realm ----------
-keep class io.realm.annotations.RealmModule
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.internal.Keep
-keep @io.realm.internal.Keep class * { *; }
-dontwarn javax.**
-dontwarn io.realm.*
##---------------End: proguard configuration for realm ----------
##---------------Begin: proguard configuration for Parcel ----------
-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }
-keep class org.parceler.Parceler$$Parcels
-keep @org.parceler.Parcel class * { *; }
-keep class *$$Parcelable { *; }
##---------------End: proguard configuration for Parcel ----------
我试图包裹的对象看起来像:
@Parcel(implementations = { ContentRealmProxy.class },
value = Parcel.Serialization.BEAN,
analyze = { Content.class })
public class Content extends RealmObject {
....
}
预先感谢