Flutter 运行时出错:异常:Gradle 任务 assembleDebug 失败,退出代码为 1

问题描述 投票:0回答:1

我试图使用 flutter 和 firebase 制作一个聊天应用程序,但随后发生了此错误。

以下是所有错误

   > There was a failure while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
         > 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 41s
[!] App requires Multidex support
    Multidex support is required for your android app to build since the number of methods has exceeded 64k. See https://docs.flutter.dev/deployment/android#enabling-multidex-support for more information. You may pass the --no-multidex flag to skip Flutter's multidex support to use a manual solution.

    Flutter tool can add multidex support. The following file will be added by flutter:

        android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java

cannot prompt without a terminal ui
Exception: Gradle task assembleDebug failed with exit code 1

flutter firebase dart google-cloud-firestore firebase-authentication
1个回答
0
投票

您需要启用错误代码中提到的 MultiDex。您可以在“build.gradle”中执行此操作。通常,如果您的文件变大或使用大量资源,则会出现此故障代码。

指南如何操作。

在堆栈跟踪中,您可以看到有关如何启用它的其他信息。

© www.soinside.com 2019 - 2024. All rights reserved.