Multiple dex files define Lcom/google/firebase/iid/zzb;

After adding this package i’ve got this error

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)

:app:transformClassesWithDexForDebug FAILED

app/build.gradle

dependencies {
    compile project(':react-native-firebase')
    compile project(':react-native-material-kit')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-camera')
    compile project(':react-native-fs')
    compile project(':react-native-push-notification')
}

Also I’m trying to exclude group: 'com.google.android.gms' -same error

RN: 0.43.3

Any ideas?

Thanks

2 thoughts on “Multiple dex files define Lcom/google/firebase/iid/zzb;

  1. I got the same conflict with react-native-device-info and solved it with :

        compile (project(':react-native-device-info')) {
            exclude group: "com.google.android.gms"
        }
    
  2. Its the google services that’s builtin on the emulator that’s the issue e.g. Play Store, just need to get a new emulator image with updated google services on the SDK Manager. It’s separate to anything in the gradle files.

    Code 2 just means it’s slightly out of date and could potentially cause issues if the user doesn’t update services on their device. Code 9 in @BlakeRxxk ‘s case means the device doesn’t have it at all – usual for genymotion emulators.

    @chrisbianca added an option to automatically prompt the user to update using android’s built in method: baa198e – not been released yet though I don’t think.

    Worth noting this is an android only issue as Firebase requires Google Play Services on the device to work, ios it does not.

Multiple dex files define Lcom/google/firebase/iid/zzb;

After adding this package i’ve got this error

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)

:app:transformClassesWithDexForDebug FAILED

app/build.gradle

dependencies {
    compile project(':react-native-firebase')
    compile project(':react-native-material-kit')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-camera')
    compile project(':react-native-fs')
    compile project(':react-native-push-notification')
}

Also I’m trying to exclude group: 'com.google.android.gms' -same error

RN: 0.43.3

Any ideas?

Thanks

2 thoughts on “Multiple dex files define Lcom/google/firebase/iid/zzb;

  1. I got the same conflict with react-native-device-info and solved it with :

        compile (project(':react-native-device-info')) {
            exclude group: "com.google.android.gms"
        }
    
  2. Its the google services that’s builtin on the emulator that’s the issue e.g. Play Store, just need to get a new emulator image with updated google services on the SDK Manager. It’s separate to anything in the gradle files.

    Code 2 just means it’s slightly out of date and could potentially cause issues if the user doesn’t update services on their device. Code 9 in @BlakeRxxk ‘s case means the device doesn’t have it at all – usual for genymotion emulators.

    @chrisbianca added an option to automatically prompt the user to update using android’s built in method: baa198e – not been released yet though I don’t think.

    Worth noting this is an android only issue as Firebase requires Google Play Services on the device to work, ios it does not.

Multiple dex files define Lcom/google/firebase/iid/zzb;

After adding this package i’ve got this error

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)

:app:transformClassesWithDexForDebug FAILED

app/build.gradle

dependencies {
    compile project(':react-native-firebase')
    compile project(':react-native-material-kit')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-camera')
    compile project(':react-native-fs')
    compile project(':react-native-push-notification')
}

Also I’m trying to exclude group: 'com.google.android.gms' -same error

RN: 0.43.3

Any ideas?

Thanks

3 thoughts on “Multiple dex files define Lcom/google/firebase/iid/zzb;

  1. I got the same conflict with react-native-device-info and solved it with :

        compile (project(':react-native-device-info')) {
            exclude group: "com.google.android.gms"
        }
    
  2. Its the google services that’s builtin on the emulator that’s the issue e.g. Play Store, just need to get a new emulator image with updated google services on the SDK Manager. It’s separate to anything in the gradle files.

    Code 2 just means it’s slightly out of date and could potentially cause issues if the user doesn’t update services on their device. Code 9 in @BlakeRxxk ‘s case means the device doesn’t have it at all – usual for genymotion emulators.

    @chrisbianca added an option to automatically prompt the user to update using android’s built in method: baa198e – not been released yet though I don’t think.

    Worth noting this is an android only issue as Firebase requires Google Play Services on the device to work, ios it does not.

Multiple dex files define Lcom/google/firebase/iid/zzb;

After adding this package i’ve got this error

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)

:app:transformClassesWithDexForDebug FAILED

app/build.gradle

dependencies {
    compile project(':react-native-firebase')
    compile project(':react-native-material-kit')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-camera')
    compile project(':react-native-fs')
    compile project(':react-native-push-notification')
}

Also I’m trying to exclude group: 'com.google.android.gms' -same error

RN: 0.43.3

Any ideas?

Thanks

1 possible answer(s) on “Multiple dex files define Lcom/google/firebase/iid/zzb;

  1. I got the same conflict with react-native-device-info and solved it with :

        compile (project(':react-native-device-info')) {
            exclude group: "com.google.android.gms"
        }