问题描述
我在尝试构建 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 的答案中找到了这个解决方案。