How to install realm as a gradle dependency?

可紊 提交于 2019-11-30 18:43:08

Move the buildscript to your main build.gradle file (Project) , it shouldn't be there in build.gradle (module:app)

buildscript {
repositories {
    jcenter()
  }
dependencies {
     classpath "io.realm:realm-gradle-plugin:<realm version>"
   }
 }

This should go to main build.gradle

WaterRocket8236

First of all copy the class path dependency to build.gradle file(Project):-

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "io.realm:realm-gradle-plugin:1.2.0"
    }
}

Finally, copy and paste the following code on top of build.gradle(App) :-

apply plugin: 'realm-android'

Note:- The version 1.2.0 is subjected to change on future releases.For more please check https://realm.io/docs/java/latest/

Prerequisites

  • Android Studio version 1.5.1 or higher
  • JDK version 7.0 or higher
  • A recent version of the Android SDK
  • Android API Level 9 or higher (Android 2.3 and above)

Step 1: Add the class path dependency to the project level build.gradle file.

buildscript {
 repositories {
    jcenter()
 }
 dependencies {
    classpath "io.realm:realm-gradle-plugin:4.1.1"
 }
}

Step 2: Apply the realm-android plugin to the top of the application level build.gradle file.

apply plugin: 'realm-android'

Step 3: Gradle sync

For the official complete installation guide. Please see the following link.

https://realm.io/docs/java/latest/#installation

The method I used is

   `     dependencies 
{
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath "io.realm:realm-gradle-plugin:3.1.4"

    }`

in your main build gradle file then add

apply plugin: 'realm-android'

and

 compile 'io.realm:android-adapters:2.0.0'

in your app's build gradle

this link to bintray will give you the latest build https://bintray.com/realm/maven/realm-android-library/3.4.0#files/io%2Frealm%2Frealm-android-library%2F3.4.0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!