ip696
ip696

Reputation: 7084

Error:Error converting bytecode to dex: Realm

Realm in android get error:

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'

I tried clean project rebuild project not happend

Upvotes: 1

Views: 195

Answers (1)

EpicPandaForce
EpicPandaForce

Reputation: 81539

You can easily fix this problem like so:

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

Upvotes: 1

Related Questions