Realm 0.88.2 示例:无法解析符号 [英] Realm 0.88.2 example : Cannot resolve symbol
问题描述
我下载了这个:
当我在 build.gradle 中添加compile 'io.realm:realm-android:0.87.5'"时,发生此错误:
<代码>[...]:introExample:generateDebugSources 最新:introExample:compileDebugJavaWithJavac注意:处理类 Cat注:处理类Dog注意:处理类Person注意:创建 DefaultRealmModule:introExample:compileDebugNdk 最新:introExample:compileDebugSources:introExample:transformClassesWithRealmTransformerForDebug:introExample:transformClassesWithDexForDebug意外的顶级例外:com.android.dex.DexException: 多个 dex 文件定义了 Lio/realm/RealmCache$Callback;在 com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)在 com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)在 com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)在 com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)在 com.android.dx.merge.DexMerger.merge(DexMerger.java:189)在 com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)在 com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)在 com.android.dx.command.dexer.Main.run(Main.java:277)在 com.android.dx.command.dexer.Main.main(Main.java:245)在 com.android.dx.command.Main.main(Main.java:106)失败的FAILURE:构建失败,出现异常.[...]
从 v0.88.0 开始,您需要使用 AAR 配置(使用 Gradle),通过将 Realm 插件添加到应用程序类路径并应用该插件.
>
buildscript {存储库{jcenter()}依赖{类路径io.realm:realm-gradle-plugin:0.88.2"}}应用插件:'realm-android'
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'
这篇关于Realm 0.88.2 示例:无法解析符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!