【问题标题】:Process unexpectedly exit: Build failed with an exception进程意外退出:构建失败并出现异常
【发布时间】:2020-10-26 21:13:13
【问题描述】:

当我尝试构建时,我正在处理 Android 项目,它显示“失败:构建失败并出现异常”。这是我得到的完整错误

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> 8 exceptions were raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #0: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #1: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #2: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #3: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #4: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #5: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #6: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #7: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.

在 gradle-wrapper.properties 中,distributionUrl 是 https://services.gradle.org/distributions/gradle-5.1.1-all.zip,而在 build.gradle 中,依赖项是

com.android.tools.build:gradle:3.4.2
com.google.gms:google-services:4.3.3

我该如何解决这个错误。

【问题讨论】:

    标签: java android android-studio gradle


    【解决方案1】:

    你可以尝试的事情

    1.尝试清理/重建您的项目,这对我有用。

    1. 尝试降级您的 gradle 版本

      dependencies {
                  classpath 'com.android.tools.build:gradle:1.5.0'
                                 }
      

    3.您可能损坏了可绘制文件。如果有,请搜索并将其删除。

    1. 尝试使缓存无效/重启 android studio。

    【讨论】:

    • 当我降级到 com.android.tools.build:gradle:3.2.1 com.google.gms:google-services:4.2.0 它工作但显示 registerResGeneratingTask 已弃用,使用 registerGeneratedResFolders(FileCollection )
    猜你喜欢
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2015-02-20
    • 2018-07-28
    • 2019-02-23
    • 2022-01-06
    • 2020-12-12
    相关资源
    最近更新 更多