| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Java version of Realm, which currently runs only on Android.
Please see the detailed instructions in our docs to add Realm to your project.
Documentation for Realm can be found at realm.io/docs/java. The API reference is located at realm.io/docs/java/api.
If you want to test recent bugfixes or features that have not been packaged in an official release yet, you can use a -SNAPSHOT release of the current development version of Realm via Gradle, available on JFrog OSS
buildscript {
repositories {
jcenter()
google()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
classpath "io.realm:realm-gradle-plugin:<version>-SNAPSHOT"
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
}
See version.txt for the latest version number.
In case you don't want to use the precompiled version, you can build Realm yourself from source.
Download the JDK 8 from Oracle and install it.
The latest stable version of Android Studio. Currently 3.1.4.
Download & install the Android SDK Build-Tools 27.0.2, Android Oreo (API 27) (for example through Android Studio’s Android SDK Manager).
Install CMake from SDK manager in Android Studio ("SDK Tools" -> "CMake").
Realm currently requires version r10e of the NDK. Download the one appropriate for your development platform, from the NDK archive. You may unzip the file wherever you choose. For macOS, a suggested location is ~/Library/Android. The download will unzip as the directory android-ndk-r10e.
If you will be building with Android Studio, you will need to tell it to use the correct NDK. To do this, define the variable ndk.dir in realm/local.properties and assign it the full pathname of the directory that you unzipped above. Note that there is a local.properites in the root directory that is not the one that needs to be edited.
ndk.dir=/Users/brian/Library/Android/android-ndk-r10e/r10e
Add two environment variables to your profile (presuming you installed the NDK in ~/Library/android-ndk-r10e):
export ANDROID_HOME=~/Library/Android/sdk export ANDROID_NDK_HOME=~/Library/Android/android-ndk-r10e
If you are launching Android Studio from the macOS Finder, you should also run the following two commands:
launchctl setenv ANDROID_HOME "$ANDROID_HOME" launchctl setenv ANDROID_NDK_HOME "$ANDROID_NDK_HOME"
If you'd like to specify the location in which to store the archives of Realm Core, define the REALM_CORE_DOWNLOAD_DIR environment variable. It enables you to keep Core's archive when executing git clean -xfd.
export REALM_CORE_DOWNLOAD_DIR=~/.realmCore
macOS users must also run the following command for Android Studio to see this environment variable.
launchctl setenv REALM_CORE_DOWNLOAD_DIR "$REALM_CORE_DOWNLOAD_DIR"
It would be a good idea to add all of the symbol definitions (and their accompanying launchctl commands, if you are using macOS) to your ~/.profile (or ~/.zprofile if the login shell is zsh)
If you develop Realm Java with Android Studio, we recommend you to exclude some directories from indexing target by executing following steps on Android Studio. It really speeds up indexing phase after the build.
You can download the source code of Realm Java by using git. Since realm-java has git submodules, use --recursive when cloning the repository.
git clone git@github.com:realm/realm-java.git --recursive
or
git clone https://github.com/realm/realm-java.git --recursive
Once you have completed all the pre-requisites building Realm is done with a simple command.
./gradlew assemble
That command will generate:
The full build may take an hour or more, to complete.
Generating the Javadoc using the command above may generate warnings. The Javadoc is generated despite the warnings.
All gradle projects in this repository have wrapper task to generate Gradle Wrappers. Those tasks refer to gradleVersion property defined in /dependencies.list to determine Gradle Version of generating wrappers. We have a script ./tools/update_gradle_wrapper.sh to automate these steps. When you update Gradle Wrappers, please obey the following steps.
The repository is organized into six Gradle projects:
This means that ./gradlew clean and ./gradlew cleanExamples will fail if assembleExamples has not been executed first. Note that IntelliJ does not support multiple projects in the same window so each of the six Gradle projects must be imported as a separate IntelliJ project.
Since the repository contains several completely independent Gradle projects, several independent builds are run to assemble it. Seeing a line like: :realm:realm-library:compileBaseDebugAndroidTestSources UP-TO-DATE in the build log does not imply that you can run ./gradlew :realm:realm-library:compileBaseDebugAndroidTestSources.
The ./examples folder contains many example projects showing how Realm can be used. If this is the first time you checkout or pull a new version of this repository to try the examples, you must call ./gradlew installRealmJava from the top-level directory first. Otherwise, the examples will not compile as they depend on all Realm artifacts being installed in mavenLocal().
Standalone examples can be downloaded from website.
To run these tests, you must have a device connected to the build computer, and the adb command must be in your PATH
Connect an Android device and verify that the command adb devices shows a connected device:
adb devices
List of devices attached
004c03eb5615429f deviceRun instrumentation tests:
cd realm
./gradlew connectedBaseDebugAndroidTestThese tests may take as much as half an hour to complete.
Tests in realm/realm-library/src/syncIntegrationTest require a running testing server to work. A docker image can be built from tools/sync_test_server/Dockerfile to run the test server. tools/sync_test_server/start_server.sh will build the docker image automatically.
To run a testing server locally:
Install docker.
Run tools/sync_test_server/start_server.sh:
cd tools/sync_test_server
./start_server.shThis command will not complete until the server has stopped.
Run instrumentation tests
In a new terminal window, run:
cd realm
./gradlew connectedObjectServerDebugAndroidTestNote that if using VirtualBox (Genymotion), the network needs to be bridged for the tests to work. This is done in VirtualBox > Network. Set "Adapter 2" to "Bridged Adapter".
These tests may take as much as half an hour to complete.
See CONTRIBUTING.md for more details!
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to info@realm.io.
The directory realm/config/studio contains lint and style files recommended for project code. Import them from Android Studio with Android Studio > Preferences... > Code Style > Manage... > Import, or Android Studio > Preferences... > Inspections > Manage... > Import. Once imported select the style/lint in the drop-down to the left of the Manage... button.
Realm Java is published under the Apache 2.0 license.
Realm Core is also published under the Apache 2.0 license and is available here.
This product is not being made available to any person located in Cuba, Iran, North Korea, Sudan, Syria or the Crimea region, or to any other person that is not eligible to receive the product under U.S. law.
If you use Realm and are happy with it, all we ask is that you, please consider sending out a tweet mentioning @realm to share your thoughts!
And if you don't like it, please let us know what you would like improved, so we can fix it!
| Back | FazBrowse Home | New Git URL |