错误:将字节码转换为dex时出错:Realm

时间:2017-11-20 10:39:46

标签: android gradle realm android-studio-3.0

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'

我试过干净的项目重建项目没有发生

1 个答案:

答案 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