0

Obtengo el error Execution failed for task ':app:mergeDexDebug' cuando instalo react-native-fbsdk 2.0.0 y ejecuto react-native run-android.

Mi proyecto con react-native:

 npmPackages:
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2

android/build.gradle:

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 16
        compileSdkVersion = 29
        targetSdkVersion = 29
    }
}

consola:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
     The number of method references in a .dex file cannot exceed 64K.
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
warning: [options] source value 7 is obsolete and will be removed in a future release

1 respuesta 1

0

Añadir en android/app/build.gradle:

android {
    .
    .
    .

defaultConfig {
    applicationId "com.app"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    }
        .
        .
        .
   }

la línea :

multiDexEnabled true

1
  • Si la versión minSdkVersion es 21 o posterior, multidex se habilitará de forma predeterminada y no se requerirá la biblioteca de compatibilidad multidex. Commented el 8 ago. 2020 a las 20:09

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.