Android 错误:将字节码转换为dex:Realm时出错
android中的域获取错误:Android 错误:将字节码转换为dex:Realm时出错,android,gradle,realm,android-studio-3.0,Android,Gradle,Realm,Android Studio 3.0,android中的域获取错误: Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lio/realm/Realm$1$1; 康吉格: apply plugin: 'realm-android' buildscript { repositories { jcenter() } dependencies
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lio/realm/Realm$1$1;
康吉格:
apply plugin: 'realm-android'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:4.2.0"
}
}
realm {
syncEnabled = true
}
compile 'io.realm:realm-android:0.87.5'
annotationProcessor 'io.realm:realm-android:0.87.5'
我尝试了clean project rebuild project not happend您可以像这样轻松解决此问题:
apply plugin: 'realm-android'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:4.2.0"
}
}
realm {
syncEnabled = true
}
//compile 'io.realm:realm-android:0.87.5' // <-- removed
//annotationProcessor 'io.realm:realm-android:0.87.5' // <-- removed
apply插件:'realmandroid'
构建脚本{
存储库{
jcenter()
}
依赖关系{
classpath“io.realm:realm gradle插件:4.2.0”
}
}
王国{
syncEnabled=true
}
//编译'io.realm:realm android:0.87.5'//为什么您使用两个不同版本的realm?为什么您同时使用版本0.87.5和4.2.0?我不需要依赖关系?如何使用?))我花了这么多时间来查找。在文档中有一个例子,我看到了0.72。ⅩRealm Gradle插件为您添加了依赖项