I can not download the ORM Realm library in Android Studio . Usually, to load a third-party library, it was enough to build.gradle line in build.gradle , in this case I tried to enter:

 dependencies { compile 'io.realm:realm-gradle-plugin:1.1.0' } 

But when importing in a class, it does not see RealmObject

 import io.realm.RealmObject; dependencies { classpath 'io.realm:realm-gradle-plugin:1.1.0' } 

That gives an error:

Error: (27, 0) Could not find method class () for arguments [io.realm: realm-gradle-plugin: 1.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler . Open file

Who installed the realm? What am I doing wrong?

    2 answers 2

    The project website has detailed instructions :

    1. In the build.gradle level of the project we write

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

      }

    2. In the build.gradle application level :

       apply plugin: 'com.android.application' apply plugin: 'realm-android' 
    3. Update Gradle configuration (tools -> android -> sync project with gradle files)

    • Thank you)) You do not know by chance where there is useful documentation for beginners in Realm, at least how to add and load a row from the table? All that I found, either for iPhone or the devil himself will not understand - Artsait
    • @Artsait On the same site below (link to the documentation in the answer) there are all the basic CRUD operations for Java / Android. Still here I wrote a little about the information about Realm - pavlofff
    • Exactly, I remembered. We will understand - Artsait

    Read the documentation carefully: documentation , there is one more thing there such as:

    Step 2: Apply the build.gradle file.

    apply plugin: 'realm-android'

    • one
      Thank. I did not carefully read - Artsait