我得到这个错误,而我正在构建APK。

Cause 1: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
    at org.gradle.workers.internal.DefaultWorkerExecutor$WorkerExecution.waitForCompletion(DefaultWorkerExecutor.java:285)
    at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:115)
    at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForCompletion(DefaultAsyncWorkTracker.java:87)
    at org.gradle.workers.internal.DefaultWorkerExecutor.await(DefaultWorkerExecutor.java:150)
    at com.android.build.gradle.internal.tasks.Workers$WorkerExecutorAdapter.await(Workers.kt:282)
    at com.android.ide.common.resources.MergeWriter.end(MergeWriter.java:48)
    at com.android.ide.common.resources.MergedResourceWriter.end(MergedResourceWriter.java:242)
    at com.android.ide.common.resources.DataMerger.mergeData(DataMerger.java:292)
    at com.android.ide.common.resources.ResourceMerger.mergeData(ResourceMerger.java:384)
    at com.android.build.gradle.tasks.MergeResources.lambda$doFullTaskAction$1(MergeResources.java:261)
    at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:58)

试图使缓存无效并重新启动android工作室。重建项目,但没有一个为我工作。


当前回答

android studio: 3.6.3和gradle版本:

classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"

添加这一行

gradle。属性文件

org.gradle.jvmargs=-Xmx512m

其他回答

我已经启用了multidex,但版本太旧了,所以升级了,它修复了这个问题:

// Old version
implementation "com.android.support:multidex:1.0.3"
// New version
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"

对我来说,这是因为

//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:23.1.1'

//noinspection GradleCompatible
compile 'com.android.support:design:23.1.1'

试着把它拿掉。

如果你陷入下面的错误

Execution failed for task ':app:signReleaseBundle'. > A failure occurred while 
executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > 'other' 
has different root

**然后做它改变你的位置。abb的时间生成到你的 项目(这个。aab的自己的项目)然后转到app,然后选择realese 文件夹来保存你的。aab **

在我的代码中,我使用的是最新版本的flutter和包 并通过添加该行来消除此错误

multiDexEnabled true 

在应用程序级别build.gradle

遇到类似的问题…对我来说,修正是改变/更新gradle版本

   classpath "com.android.tools.build:gradle:4.1.2" 

to

   classpath "com.android.tools.build:gradle:4.1.3"

为我工作