Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zzf;

  • Why this error
    There is conflicts of having various versions of the same library, in this case, com.google.android.gms. This is caused by various react-native modules having different dependencies.

  • Resolution

  1. Search all the native dependencies in node_modules of build.gradle starting with com.google.android.gms or com.google.firebase.

    Example, react-native-device-info is dependent on:
    compile 'com.google.android.gms:play-services-gcm:+'

  2. Exclude the dependencies in the /android/app/build.gradle, eg:

    compile (project(':react-native-device-info')) {
        exclude group: "com.google.android.gms"
  3. Force to use the same version for all modules, eg:

    compile ("com.google.android.gms:play-services-gcm:10.0.1") {
        force = true;