Android Gradle 构建错误 "AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon."

Android Gradle build error "AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon."

我在尝试构建 Android 应用程序时遇到此错误:

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
     This should not happen under normal circumstances, please file an issue if it does.

我发现的大多数其他解决方案都与项目中的图像太大有关,但是这对我不起作用,因为我所有的图像都小于 50kb。

我发现当在项目中创建附加模块并链接到其他应用程序模块(使用 implementation project)但模块 build.gradle 文件中的插件设置为 'com.android.application' 而不是 'com.android.library'.

我在另一个问题的回答中找到了这个解决方案 here