question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document Realm compatibility with Parceler

See original GitHub issue

Hi

I have a Realm object that is also Parcelable. I use Parceler as a workaround because it’s not possible to implement Parcelable on Realm objects. Everything has been working nicely so far, but I ran into a problem when I tried to launch an activity with ACTION_SEND set on the intent.

This is the Parceler exception I’m getting (logged a bug for them here https://github.com/johncarl81/parceler/issues/106):

org.parceler.ParcelerRuntimeException: Unable to find generated Parcelable class for io.realm.MessageRealmProxy, verify that your class is configured properly and that the Parcelable class io.realm.MessageRealmProxy$$Parcelable is generated by Parceler.
           at org.parceler.Parcels$ParcelCodeRepository.get(Parcels.java:201)
           at org.parceler.Parcels.wrap(Parcels.java:85)
           at org.parceler.Parcels.wrap(Parcels.java:69)
           at org.parceler.NonParcelRepository$ListParcelable$1.itemToParcel(NonParcelRepository.java:280)
           at org.parceler.converter.CollectionParcelConverter.toParcel(CollectionParcelConverter.java:38)
           at org.parceler.converter.CollectionParcelConverter.toParcel(CollectionParcelConverter.java:27)
           at org.parceler.NonParcelRepository$ConverterParcelable.writeToParcel(NonParcelRepository.java:1222)
           at org.parceler.NonParcelRepository$ListParcelable.writeToParcel(NonParcelRepository.java:269)
           at android.os.Parcel.writeParcelable(Parcel.java:1357)
           at android.os.Parcel.writeValue(Parcel.java:1262)
           at android.os.Parcel.writeArrayMapInternal(Parcel.java:638)
           at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
           at android.os.Bundle.writeToParcel(Bundle.java:1096)
           at android.os.Parcel.writeBundle(Parcel.java:663)
           at android.support.v4.app.FragmentState.writeToParcel(Fragment.java:137)
           at android.os.Parcel.writeTypedArray(Parcel.java:1191)
           at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:384)
           at android.os.Parcel.writeParcelable(Parcel.java:1357)
           at android.os.Parcel.writeValue(Parcel.java:1262)
           at android.os.Parcel.writeArrayMapInternal(Parcel.java:638)
           at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
           at android.os.Bundle.writeToParcel(Bundle.java:1096)
           at android.os.Parcel.writeBundle(Parcel.java:663)
           at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2901)
           at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3290)
           at android.os.Handler.handleCallback(Handler.java:739)
           at android.os.Handler.dispatchMessage(Handler.java:95)
           at android.os.Looper.loop(Looper.java:135)
           at android.app.ActivityThread.main(ActivityThread.java:5254)
           at java.lang.reflect.Method.invoke(Native Method)
           at java.lang.reflect.Method.invoke(Method.java:372)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)

The realm object is called Message and is set to be parcelable using the following annotation:

@RealmClass
@Parcel(implementations = { Message.class }, value = Parcel.Serialization.BEAN, analyze = { Message.class })
public class Message extends RealmObject {

The class is not just a simple POJO, it has some static methods that parses data and some of the member variables are set as @Ignore, but I’ve tried simplifying it, and I still get the same error.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
LaurieScheeperscommented, Oct 17, 2017

Haha I came across this now randomly almost 2 years later, after wanting to do the same thing again in a new project and realized I was the one who originally started this discussion. Glad to have helped. And to have helped myself. 😃

1reaction
mateusgrbcommented, Dec 21, 2015

@johncarl81 Thanks for the answer. I found them under the build folder(using Find File tool in Android Studio), but can’t import. And if I don’t import them, I get a compile error if I try something like “implementations = { MyObjectRealmProxy.class }”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Parceler | CodePath Android Cliffnotes
The Parceler library works by using the @Parcel annotation to generate the wrapper classes for you. It works with many of the most...
Read more >
kotlin + parceler + Realm - Stack Overflow
I'm trying to integrate Parceler library in a Kotlin project with Realm, but I'm facing with problems when I try to adapt an...
Read more >
Realm: Create reactive mobile apps in a fraction ... - MongoDB
Enabling Realm Mobile Platform: Before your application can synchronize with the Realm Object Server, it has to be enabled in your build file....
Read more >
Create reactive mobile apps in a fraction of the time - Realm
If you need help finding your app's Realm file, check this StackOverflow answer for ... If you've already updated to Realm Java 0.83,...
Read more >
Realm for Android | Blog by Sapan Diwakar
Realm is a mobile database: a replacement for SQLite & Core Data that works for both iOS and Android. It has a really...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found