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
-
Search all the native dependencies in
node_modules
ofbuild.gradle
starting withcom.google.android.gms
orcom.google.firebase
.Example,
react-native-device-info
is dependent on:
compile 'com.google.android.gms:play-services-gcm:+'
-
Exclude the dependencies in the /android/app/build.gradle, eg:
compile (project(':react-native-device-info')) { exclude group: "com.google.android.gms" }
-
Force to use the same version for all modules, eg:
compile ("com.google.android.gms:play-services-gcm:10.0.1") { force = true; }