I downloaded this : https://static.realm.io/downloads/java/realm-java-0.88.2.zip Then imported the "examples" folder inside Android Studio.
I can run examples but Android Studio cannot resolve symbols for Realm classes.
Is there something missing in this example project ? I want to enable completion.
Edit :
When I add "compile 'io.realm:realm-android:0.87.5'" to the build.gradle,
this error occur :
[...]
:introExample:generateDebugSources UP-TO-DATE
:introExample:compileDebugJavaWithJavac
Note: Processing class Cat
Note: Processing class Dog
Note: Processing class Person
Note: Creating DefaultRealmModule
:introExample:compileDebugNdk UP-TO-DATE
:introExample:compileDebugSources
:introExample:transformClassesWithRealmTransformerForDebug
:introExample:transformClassesWithDexForDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lio/realm/RealmCache$Callback;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
FAILED
FAILURE: Build failed with an exception.
[...]
Since v0.88.0, you need to use the AAR configuration (using Gradle), by adding the Realm plugin to the application classpath and applying the plugin.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:0.88.2"
}
}
apply plugin: 'realm-android'