task :app:mergedexdebug failed react native

JavaScript
Go to android/app/build.gradle and add the following lines of codes:

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

dependencies {
  // multidex support at time of writing this 1.0.3 was latest make sure you add latest version
  implementation 'com.android.support:multidex:1.0.3'
}
Source

Also in JavaScript: