Add the following dependency to your project level build.gradle
file.
dependencies {
classpath "io.realm:realm-gradle-plugin:3.1.2"
}
Add the following right at the top of your app level build.gradle
file.
apply plugin: 'realm-android'
Complete a gradle sync and you now have Realm added as a dependency to your project!
Realm requires an initial call since 2.0.0 before using it. You can do this in your Application
class or in your first Activity's onCreate
method.
Realm.init(this); // added in Realm 2.0.0
Realm.setDefaultConfiguration(new RealmConfiguration.Builder().build());