Solution 1 :
add in android/app/build.gradle:
android {
.
.
.
defaultConfig {
applicationId "com.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
.
.
.
}
the line :
multiDexEnabled true
Solution 2 :
Can you try this bt=y adding
In your module level build.gradle file. Something like this:
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true
}
...
}
Problem :
I get Execution failed for task ‘:app:mergeDexDebug’ when I install react-native-fbsdk 2.0.0 and then run react-native run-android.
My project with 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
}
}
console:
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
Comments
Comment posted by Jéssica Román Largo
If the minSdkVersion version is 21 or later, multidex will be enabled by default and the multidex compatibility library will not be required.