Importing and runnning example from git

90 views
Skip to first unread message

Rami-John Fares

unread,
Nov 18, 2015, 4:17:32 AM11/18/15
to Realm Java
Hi,
I have struggled for the last 2 days to run the example apps from the Realm git repository (I'm a newbie).
Can I get detailed steps on how to import the git repository and run the examples?

So far I imported the project, pointed at the top level build.gradle, and I'm lost, I can't figure out how to setup my project so that I can run any of the examples inside the example folder.
The run button is grayed out, the plugins are not imported and there are no modules.

I do appreciate some help, I'm desperate.

Christian Melchior

unread,
Nov 18, 2015, 4:47:11 AM11/18/15
to Rami-John Fares, realm...@googlegroups.com
I am assuming you cloned our master do so?

We recently restructured our repository so we can support having both the Gradle plugin, Library and Examples. Unfortunately there are some circular dependencies among them which makes it impossible to have them all in the same Android Studio project.

This means that our repository actually consists of 3 independent projects and one "umbrella" project that just have hooks into some common subtasks.

/realm-java/ is the main umbrella project
/realm-java/examples/ contains all our examples
/realm-java/realm/ contains our library
/realm-java/gradle-plugin/ contains our gradle plugin

So to get it to work:

1) Checkout realm-java
2) Run `./gradlew assemble` from `/realm-java/` . This will build and install all relevant libraries/plugins into mavenLocal() so the examples compile
3) Open `/realm-java/examples/` as a project inside AndroidStudio
4) You should now be able to run all examples.

This is also described in our README https://github.com/realm/realm-java/blob/master/README.md
But any feedback on how we can improve the description would be helpful. Thanks.

I hope this helps.

--
Christian Melchior
Senior Android Developer
{#HS:140155474-2284#}
--
You received this message because you are subscribed to the Google Groups "Realm Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to realm-java+...@googlegroups.com.
To post to this group, send email to realm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/realm-java/a01321ee-8ea3-4101-8f48-47e8c5cd9b93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Rami-John Fares

unread,
Nov 18, 2015, 5:31:32 AM11/18/15
to Realm Java, rjf...@gmail.com, he...@realm.io
Thanks for the quick reply!
I also noticed now what's the problem when assembling: Your NDK version: r10e. Realm JNI should be compiled with the version r10d of NDK.
I'm downloading the r10d now hopefully that will solve the problem.

Rami-John Fares

unread,
Nov 18, 2015, 12:27:15 PM11/18/15
to Realm Java, rjf...@gmail.com, he...@realm.io
Got an error while assembling:

:realm:realm-jni:deployCore FAILED
:installRealm FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':realm-jni:deployCore'.
> A problem occurred starting process 'command 'rm''

Any idea? Thanks for your patience

Christian Melchior

unread,
Nov 18, 2015, 12:32:12 PM11/18/15
to Rami-John Fares, realm...@googlegroups.com, rjf...@gmail.com
Are you building on Windows? It seems to be complaining about the `rm` command.


--
Christian Melchior
Senior Android Developer
{#HS:140155474-2284#}
On Wed, Nov 18, 2015 at 9:46 AM UTC, Christian Melchior <he...@realm.io> wrote:
I am assuming you cloned our master do so?

We recently restructured our repository so we can support having both the Gradle plugin, Library and Examples. Unfortunately there are some circular dependencies among them which makes it impossible to have them all in the same Android Studio project.

This means that our repository actually consists of 3 independent projects and one "umbrella" project that just have hooks into some common subtasks.

/realm-java/ is the main umbrella project
/realm-java/examples/ contains all our examples
/realm-java/realm/ contains our library
/realm-java/gradle-plugin/ contains our gradle plugin

So to get it to work:

1) Checkout realm-java
2) Run `./gradlew assemble` from `/realm-java/` . This will build and install all relevant libraries/plugins into mavenLocal() so the examples compile
3) Open `/realm-java/examples/` as a project inside AndroidStudio
4) You should now be able to run all examples.

This is also described in our README https://github.com/realm/realm-java/blob/master/README.md
But any feedback on how we can improve the description would be helpful. Thanks.

I hope this helps.

--
Christian Melchior
Senior Android Developer


Rami-John Fares

unread,
Nov 18, 2015, 12:48:53 PM11/18/15
to Realm Java, rjf...@gmail.com, he...@realm.io
Yes I am

Christian Melchior

unread,
Nov 19, 2015, 3:53:14 AM11/19/15
to Rami-John Fares, realm...@googlegroups.com, rjf...@gmail.com
Unfortunately we don't support building from Windows right now because of some of our build scripts. It might be possible to make it work with CygWin, but we haven't tested it fully. There is an issue here tracking this: https://github.com/realm/realm-java/issues/911


--
Christian Melchior
Senior Android Developer
{#HS:140155474-2284#}
On Wed, Nov 18, 2015 at 5:48 PM UTC, Rami-John Fares <rjf...@gmail.com> wrote:
Yes I am



On Wed, Nov 18, 2015 at 5:31 PM UTC, Christian Melchior <he...@realm.io> wrote:
Are you building on Windows? It seems to be complaining about the `rm` command.

--
Christian Melchior
Senior Android Developer


Rami-John Fares

unread,
Nov 19, 2015, 4:01:50 AM11/19/15
to Realm Java, he...@realm.io
Ok thanks.
I have actually started using realm nevertheless and I found it amazing, looking forward for a v1 release.
In the meantime I do feel like the examples included would greatly benefit me, so is there a way I can run them without building the whole github project (since I use windows) ?
I tried to import only the examples folder but it's missing so many dependencies without building the top-level folder.

Christian Melchior

unread,
Nov 19, 2015, 4:12:07 AM11/19/15
to Rami-John Fares, realm...@googlegroups.com
Yes, you can just make a small change to the build.gradle file for each project:

1) Remove apply plugin: 'realm'
2) Add

dependencies {
compile 'io.realm:realm-android:0.84.2'

}





--
Christian Melchior
Senior Android Developer
{#HS:140155474-2284#}
On Wed, Nov 18, 2015 at 5:48 PM UTC, Rami-John Fares <rjf...@gmail.com> wrote:
Yes I am



On Wed, Nov 18, 2015 at 5:31 PM UTC, Christian Melchior <he...@realm.io> wrote:
Are you building on Windows? It seems to be complaining about the `rm` command.

--
Christian Melchior
Senior Android Developer


Reply all
Reply to author
Forward
0 new messages