我使用的是领域和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.虽然我已经配置了Pro卫兵规则,例如:
##---------------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 {
....
}提前感谢
发布于 2016-10-24 07:53:03
您可以添加它并查看它是否有帮助:
#realm
-keepnames public class * extends io.realm.RealmObject
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.** { *; }
-dontwarn javax.**
-dontwarn io.realm.**我认为问题在于,虽然您保留了您的RealmObjects的名称,但实际上并不保留您的领域代理类的名称。
所以这条线
-keepnames public class * extends io.realm.RealmObject光靠自己就够了。
https://stackoverflow.com/questions/40211916
复制相似问题