-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Realm can not find RealmObject extended models which are present in my custom .jar #693
Comments
Are you sure the title of this issues is the problem? Not that you forgot to start a transaction before modifying your object? How do you get to that conclusion? |
Hi bmunkholm, Sorry to confuse with the transaction error. I was getting this for other reason. I still see one issue in using Realm with jar having model files that extends RealmObject. I included the jar in the project and also have the Realm jar in the same project. The anotation process creates the proxy class for all the extended Realm object that are defined in the application but it fails to scan jar(compiled class files) and generate the anotation object. As far as my understanding, anotation works on the source(.java) files and not on the compiled(.class) files. Let me know if I am misunderstanding something here? Thanks for all the help and support. Please Find Project link |
The model classes are processed and proxy classes are created. If your model class is |
Hi @kneth, Thanks for reply. I followed your tips and included all proxy classes in a jar. It's really great works with realm models which are present within a jar. But when I use jar in project where other realm models were present, then it's started giving multiple Dex error: com.android.dex.DexException: Multiple dex files define Lio/realm/ValidationList; So, After that I customized .jar and removed "io/realm/ValidationList" file then I get "Null pointer exception" inside proxy class. proxy class function & line where i got exception - @OverRide Can you please tell me where i am missing things? Realm is very quick and simple startup comparing with sqllite in application development. I would really like to use for third party libs. Thanks for all the help and support. |
Hi @Chinmay-Acharya Instead you should copy all the strings from you library ValidationList file to your app ValidationList. It is a bit cumbersome and manually process atm, but we plan to make it a lot simpler going forward. |
@Chinmay-Acharya Did this help you? Please close the issue if no problems. |
Hi @cmelchior and @bmunkholm , But in android studio, If project get build then user need to follow all the process again and again. So currently, I am using SQL lite for library creation. I am really looking forward and curious for simpler version. |
Hello @cmelchior , I've been working with Realm and Parceler, I saw that I need to use : @parcel(implementations = { FooBarProxy.class}, value = Parcel.Serialization.BEAN, analyze = {FooBar.class}) Well, I don't know how or where my 'Proxy.class' is generated... where can I find it? Thanks! |
It is under |
Hi,
I am creating a jar which contains Realm Models for storing data. Then user will add my jar and realm.jar seperatly in his project. so, in this scenario inside ".apt_generated" annotation folder the required proxy classes for realm are not getting generated as a result there is no entry in ValidationList.java class.
Below is the exception -
java.lang.IllegalStateException: Objects cannot be changed outside a transaction; see beginTransaction() for details.
W/System.err( 4036): at io.realm.internal.Group.throwImmutable(Group.java:318)
W/System.err( 4036): at io.realm.internal.Group.getTable(Group.java:213)
W/System.err( 4036): at io.realm.Realm.getTable(Realm.java:233)
W/System.err( 4036): at io.realm.RealmQuery.getTable(RealmQuery.java:101)
W/System.err( 4036): at io.realm.RealmQuery.(RealmQuery.java:58)
W/System.err( 4036): at io.realm.Realm.where(Realm.java:756)
The text was updated successfully, but these errors were encountered: