简体   繁体   English

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

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

I get Execution failed for task ':app:mergeDexDebug' when I install react-native-fbsdk 2.0.0 and then run react-native run-android.当我安装 react-native-fbsdk 2.0.0 然后运行 react-native run-android 时,我得到任务 ':app:mergeDexDebug' 的执行失败。

My project with react-native:我的 react-native 项目:

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

android/build.gradle:安卓/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

add in android/app/build.gradle:在 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 multiDexEnabled 真

Can you try this bt=y adding你可以试试这个 bt=y 添加

In your module level build.gradle file.在您的模块级别 build.gradle 文件中。 Something like this:像这样的东西:

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

暂无
暂无

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

相关问题 React Native,任务':app:mergeDexDebug'的执行失败 - React Native, Execution failed for task ':app:mergeDexDebug' 任务执行失败':react-native-fbsdk:compileReleaseJavaWithJavac' - Execution failed for task ':react-native-fbsdk:compileReleaseJavaWithJavac' react-native-fbsdk问题:AAPT,任务':app:processDebugResources'的执行失败 - React-native-fbsdk issue : AAPT, Execution failed for task ':app:processDebugResources' 反应本机fbsdk问题 - 任务:react-native-fbsdk:compileDebugJavaWithJavac FAILED - React native fbsdk issue - Task :react-native-fbsdk:compileDebugJavaWithJavac FAILED react-native 安装 react-native-fbsdk 后运行 android 失败并显示“Task:app:compileDebugJavaWithJavac FAILED” - react-native run-android fails with "Task :app:compileDebugJavaWithJavac FAILED" After installing react-native-fbsdk 如何获取用于react-native-fbsdk模块的Facebook SDK版本 - How can I get the Facebook SDK version used for react-native-fbsdk module Flutter Firebase 错误(2020)-(任务“:app:mergeDexDebug”的执行失败) - Flutter Firebase Error(2020) - (Execution failed for task ':app:mergeDexDebug') React-native-fbsdk构建错误 - React-native-fbsdk building error react-native-fbsdk编译错误 - react-native-fbsdk compilation error react native中任务':app:transformClassesWithDexForDebug'的执行失败 - Execution failed for task ':app:transformClassesWithDexForDebug' in react native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM