繁体   English   中英

当我安装 react-native-fbsdk 时,我得到:任务':app:mergeDexDebug'的执行失败

[英]When I install react-native-fbsdk I get: Execution failed for task ':app:mergeDexDebug'

当我安装 react-native-fbsdk 2.0.0 然后运行 react-native run-android 时,我得到任务 ':app:mergeDexDebug' 的执行失败。

我的 react-native 项目:

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

安卓/build.gradle:

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

安慰:

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

在 android/app/build.gradle 中添加:

android {
    .
    .
    .

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

该行:

multiDexEnabled 真

你可以试试这个 bt=y 添加

在您的模块级别 build.gradle 文件中。 像这样的东西:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM