FVo*_*Vod 1 android proguard realm parcelable parceler
我正在使用Realm和Parceler,一切正常,但是当我启用Proguard时,我在执行时遇到错误:
Parcels.wrap(obj)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
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.
Run Code Online (Sandbox Code Playgroud)
虽然我已经配置了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 ----------
Run Code Online (Sandbox Code Playgroud)
我试图包裹的对象看起来像:
@Parcel(implementations = { ContentRealmProxy.class },
value = Parcel.Serialization.BEAN,
analyze = { Content.class })
public class Content extends RealmObject {
....
}
Run Code Online (Sandbox Code Playgroud)
预先感谢
Epi*_*rce 10
你可以添加它,看看它是否有帮助:
#realm
-keepnames public class * extends io.realm.RealmObject
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.** { *; }
-dontwarn javax.**
-dontwarn io.realm.**
Run Code Online (Sandbox Code Playgroud)
我认为问题在于,当您保留RealmObjects的名称时,实际上并不保留Realm代理类的名称.
所以这一行
-keepnames public class * extends io.realm.RealmObject
Run Code Online (Sandbox Code Playgroud)
应该足够自己.
| 归档时间: |
|
| 查看次数: |
1496 次 |
| 最近记录: |