React Native: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'

Got same error a couple of days back, seems you've got to enable multidex to true and delete the build folder.

Go to android/app/build.gradle and add the line multiDexEnabled true and set minSdkVersion to 21 inside defaultConfig like this

...
android{
  ...
  defaultConfig {
    ...
    minSdkVersion 21
    multiDexEnabled true
  }
  ...
}
...

You can check this thread out on react-native

https://github.com/oney/react-native-gcm-android/issues/32


I have fixed by enabling the multiDex in the /android/app/build.gradle file.

android {
  defaultConfig {
    .......
    multiDexEnabled true
  }
  ......
}

Open the /android/app/build.gradle file.

Under dependencies we need to add the module, and then enable it within defaultConfig

android {
    defaultConfig {
        // ...
        multiDexEnabled true
    }
    // ...
}

dependencies {
  implementation 'com.android.support:multidex:1.0.3'
}

Tags:

React Native