Android中的Realm获取错误:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lio/realm/Realm$1$1;
Congig:
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'
我试过干净的项目重建项目没有发生
答案 0 :(得分: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' // <-- removed
//annotationProcessor 'io.realm:realm-android:0.87.5' // <-- removed