Flutter 应用程序:执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障

发布于 2025-01-17 12:59:10 字数 1118 浏览 1 评论 0原文

当我尝试通过 Android Studio 在手机上执行我的应用程序时,出现此错误。我尝试运行 flutter clean 但没有成功

 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 2m 44s
 [!] The shrinker may have failed to optimize the Java bytecode.
  To disable the shrinker, pass the `--no-shrink` flag to this command.
  To learn more, see: https://developer.android.com/studio/build/shrink-code
 Exception: Gradle task assembleDebug failed with exit code 1

有人知道如何帮助我吗?

I get this error when I try to execute my app on a phone through Android Studio. I tried running flutter clean but it didn't work

 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 2m 44s
 [!] The shrinker may have failed to optimize the Java bytecode.
  To disable the shrinker, pass the `--no-shrink` flag to this command.
  To learn more, see: https://developer.android.com/studio/build/shrink-code
 Exception: Gradle task assembleDebug failed with exit code 1

Does someone know how to help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长发绾君心 2025-01-24 12:59:10

解决这些错误的最佳方法是运行以下命令:

  1. flutter Clean
  2. flutter build build appbundle -no-sound-null-safety

如果问题持续使用,请尝试运行<<代码> -info 命令后,然后读取日志,它将为您提供潜在客户以找出问题。

The best way to go fix these errors is to run the following commands:

  1. flutter clean
  2. flutter build appbundle --no-sound-null-safety

If the issue persists try running -info after the commands then read the logs, it will give you leads to find out the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文