How to properly add dependecy for Realm in Android VS project

oxygene

(Mateusz Gałązka) #1

VS 2013
Elements 9.1.100.2111
Language Oxygene

How to properly configure Realm plugin in my gradle project ?
Can anyone help me with this ?
Here is Android Studio configuration link (how to do it in Oxygene project in VS ?)


(EvgenyK) #2

have you tried to add realm-android-library-3.1.0.aar as reference to your project?


(Mateusz Gałązka) #3

NO but how to get aar ?
When i add dependencies in gradle the aar is downloaded and compiled automatically ?
How to achieve it manually ?


(EvgenyK) #4

I’ve compiled their examples from realm-java-3.1.0.zip with examples\gradlew.bat and .aar were put into C:\Users\<jour name>\.gradle\caches\modules-2\files-2.1\io.realm\realm-android-library


(Mateusz Gałązka) #5

OK I will try … thank you !


(Mateusz Gałązka) #6

But in the future is a chance to set properly all in gradle and apply plugin in VS ?


(Carlo Kok) #7

We never had a need for this before. I’ll log a research issue.


(RemObjects) #8

Thanks, logged as bugs://77738


(marc hoffman) #9

yes, Elements fully supports resolving Grade dependencies, if you add a .gradle file to your project. i’ll find you a. example/doc link in a bit. it should not be necessary to manually download the aar.


(Mateusz Gałązka) #10

nice, thank you !


(Mateusz Gałązka) #11

Hi Marc
Any link to documentation ? Simple example how to set it in VS gradle file properly ?


(marc hoffman) #12

This doe snot cover VS specifically, but the same steps from here: https://docs.elementscompiler.com/Fire/Gradle/ should work in VS, as well.


(Mateusz Gałązka) #13

Hi Evgeny,
I did aar to my project but when i create simple example with one simple class i have error "Class is not a part of schema when i try to save data to db ? Did you have the same problem ?

var dg := new Dog;
dg.age := 11;
dg.name := 'Joke';

var db := realm.getdefaultinstance;
db.begintransaction;
db.copytorealm(dg); ->here is the problem


(EvgenyK) #14

according to https://stackoverflow.com/questions/37887303/object-is-not-part-of-the-schema-for-this-realm , different issues and workarounds can be here


(Mateusz Gałązka) #15

I tried but without success. I added aar but all people write about plugin order in gradle…
I unistalled app , clean/build… for now without success :slight_smile:


(EvgenyK) #16

try to use .gradle as described at


(Mateusz Gałązka) #17

Here are described only dependencies but all writes about applying plugins… I don’t know how to use it here…
Where should I add lines like :
apply plugin: 'com.android.application’
apply plugin: 'android-apt’
apply plugin: 'realm-android’
apply plugin: 'android-command


(Mateusz Gałązka) #18

Adding gradle with :

dependencies {
//compile ‘com.google.android.gms:play-services:+’
//compile ‘com.google.android.gms:play-services-base:+’
//compile 'com.google.android.gms:play-services-maps:+'
compile ‘io.realm:realm-gradle-plugin:3.5.0’
}
Is it correct configuration in gradle or should I do something else…
I have error druing compilation:


(Mateusz Gałązka) #19

Can i change somewhere -Xmx1024M parameter which is used during build ?


(marc hoffman) #20

Oh, i’m afraid we don’t support Gradle plugins, as we don’t actually use Gradle to build, we use msbuiid/xbuild. We only call out gradle to resolve references, so that’s all tat will work.

Not currently, no. I’ll see if i can make that an option for vNext (not the release we’ll RTM today, though, but the following beta).