Search code examples
javaandroidfirebase-realtime-databaseandroid-studio-2.0

Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zza;


I have this error:

Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zza;

I am not getting how to solve this, please help.

!!

I don't know whether to include some lib or what


Solution

  • The problems of Multiple dex files define usually arise when you have duplicate dependency entry in your app build.gradle. In this case, you have a duplicate Firebase dependencies.

    You need to use the same version either 9.0.2 or 9.6.1:

    compile 'com.google.firebase:firebase-auth:9.0.2'
    compile 'com.google.firebase:firebase-database:9.0.2'
    

    or

    compile 'com.google.firebase:firebase-auth:9.6.1'
    compile 'com.google.firebase:firebase-database:9.6.1'
    

    Please be aware that if you use some support library version like 24.0.0 there is a chance for compatibility issue with firebase. You need to use the latest of support library or find the compatible firebase version. Read more at android error while compiling com.android.support:support-v4:24.0.0