the official Realm Java bindings. In this case you need to link with the Realm core and also link the Realm JNI bindings (I assume they created one for Android / Java), and include their Java API in your project as a dependency. This would be my recommendation, because this way you can share your Realm related Java code across Android and iOS.
Generate Java bindings from the Realm Objective-C / Swift bindings with Nat/J Gen. I donât recommend this, because although you can access Realm from Java using this method, it will not be identical with the binding on Android.
As you said about adding Realm database to common module : we canât do this job because realm need android library and in ios gradle we have not access to add
apply plugin: âcom.android.applicationâ
apply plugin: ârealm-androidâ
i ask this issue from realm team and they offered me to install ios framework
i have download (framework and pod) of realm for ios platform but the problem is where is header file !
there is so file after adding this module i have add Fabric to my project by this link Crash Reporting
I assume that you try to use the community (open-source) version of Realm. I am confident that it should be possible to port the official Realm Java binding to MOE. They have an issue to support Java SE, but apparently it is low priority for them. MOE is closer to Android than to Java SE, however, we do not support Android specific APIs (except for android.util.Log) currently. They mention an AndroidNotifier class in the referenced GH issue, that should be most likely ported to MOE (e.g. using the iOS GCD API instead of Looper on Android).
I would love to see Realm Java supported on MOE. If you need help with the porting for your commercial project, feel free to contact us on our website, and we would be happy to provide you with a quote for porting Realm Java to MOE.
I would like to use Realm as well, but the Android dependency killed it as an option, and I need a solution soon. Then looked into the Onyx database, and that one is promising, pure Java and open source as well. However, Onyx requires Java 8, and MOE right now only supports Java7.
The Java7 limitation is a problem for me in working with MOE, since many current libraries require Java8 nowâŚ
Which features of Java 8 are required by Onyx? Does it run on Android 6 or older? If yes, then it will work with MOE 1.x as well. MOE 1.x uses retrolambda to support lambda functions out of the box.
MOE 2.x will be based on Android 7, so there the level of Java 8 support will be the same as with Android 7.
While I have not yet used Realm, I did like the technology they developed, e.g. they have a native core which AFAIK stores the data in a platform / language independent manner, and they have language bindings for this core. They use mmap to provide high performance access to the data ⌠etc.
Onyx Database V1.2.1 includes new features.
Android support added. We are proud to announce that Android is officially supported. You are now able to integrate the Onyx Embedded Database by using Jack & Jill compiler options. Onyx requires Java source compatibility 1.8. It will support Android OS starting with API version 9.
Iâm really thankful about youâre fast replies and best supporting of MOE.
Whoever iam force to implement this API to our project.
If i getting closer to my goal i will put here a good step by step guide here to used for anyone.
I have worked on Realm database and finally i found a good way to connect Realm database to our MOE applicationâs.
at first itâs necessary to thankful from my friend Gergely about best supporting of MOE.
be sure youâre using MOE 1.3 and later
please follow all steps one by one and be careful to donât forget any things.
Right click on ios module under Multi-OS-Engine click on create new binding
Click on icon set Name: Realm and Choose Framework type then click OK
Fill all textfieldâs like this:
Framework path: realm-objc-2.4.3/ios/dynamic/Realm.framework
Base package name: com.example.sample.pods.realm
Import Header: #import âRealm/Realm.hâ
In android studio click on then Generate Bindings (after a freezing android studio you will see Generate successfully)
Now you need to create youâr object and save them on database.
Open Xcode and create a cocoa touch (in this tutorial i will nameâd it Person)
Modify Person.h to
In AndroidStudio right click on ios module under Multi-OS-Engine click on create new binding
Click on icon set Name: Person and Choose Header type then click OK
Fill all textfieldâs like this:
Header path: xcode/Sample
Base package name: com.example.sample.model
Explicit library: model
Import Header: #import âPerson.hâ
click on then Generate Bindings (after a freezing android studio you will see Generate successfully)
Modify RLMObject.h, RLMResults.h and undo changeâs, save again and close it.
Open RLMRealm.java in android studio and modify defaultRealm method to:
public static native RLMRealm defaultRealm();
Open Person.java in android studio and add two following methodâs:
@Selector("allObjects")
public static native RLMResults<Person> allObjects();
@Generated
@Selector("init")
public native Person init();
Finally done.
here a method for save and read result:
public void save() {
RLMRealm realm = RLMRealm.defaultRealm();
Person person = Person.alloc().init();
person.setName(name.text());
person.setAdopted(false);
realm.beginWriteTransaction();
realm.addObject(person);
realm.commitWriteTransaction();
}
public void showAll() {
RLMResults<Person> results = Person.allObjects();
for (int i = 0; i < results.count(); i++) {
Person person = (Person) results.objectAtIndex(i);
Foundation.NSLog("person : " + person.name(), "");
}
}
It still doesnât work. I got error: /Realm.framework/Headers/Realm.h:21:9: error: 'RLMArray.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/RLMArray.h:21:9: error: 'RLMCollection.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:22:9: error: 'RLMMigration.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/RLMMigration.h:74:70: warning: unknown attribute 'noescape' ignored [-Wunknown-attributes] /Realm.framework/Headers/Realm.h:23:9: error: 'RLMObject.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/RLMObject.h:21:9: error: 'RLMObjectBase.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/RLMObject.h:22:9: error: 'RLMThreadSafeReference.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:24:9: error: 'RLMObjectSchema.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:25:9: error: 'RLMPlatform.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:26:9: error: 'RLMProperty.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/RLMProperty.h:20:9: error: 'RLMConstants.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:27:9: error: 'RLMRealm.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/RLMRealm.h:296:46: warning: unknown attribute 'noescape' ignored [-Wunknown-attributes] /Realm.framework/Headers/RLMRealm.h:318:46: warning: unknown attribute 'noescape' ignored [-Wunknown-attributes] /Realm.framework/Headers/Realm.h:28:9: error: 'RLMRealmConfiguration.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:29:9: error: 'RLMRealmConfiguration+Sync.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:30:9: error: 'RLMResults.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:31:9: error: 'RLMSchema.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:32:9: error: 'RLMSyncConfiguration.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:33:9: error: 'RLMSyncCredentials.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:34:9: error: 'RLMSyncManager.h' file not found with <angled> include; use "quotes" instead /Realm.framework/Headers/Realm.h:35:9: error: 'RLMSyncPermission.h' file not found with <angled> include; use "quotes" instead fatal error: too many errors emitted, stopping now [-ferror-limit=]
It seems that you have a problem on nbc file
Please check the frameworks path
I hope you can find your problem.
Please create new projects and follow all steps agin.(donât forget u need to use pod for xcode and framework for nbc file)