我得到这个错误,而我正在构建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工作室。重建项目,但没有一个为我工作。


当前回答

gradle.proprites

org.gradle.jvmargs=-Xmx1536M

build.gradle

defaultConfig {
        multiDexEnabled true
    }

dependencies {
    implementation 'com.android.support:multidex:1.0.3'
}

然而这些东西并没有解决我的问题,直到我增加编译esdkversion从27到28,它为我工作。

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
         minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    buildTypes {
        release {
            crunchPngs false
        }
    }
}

其他回答

我得到这个错误是因为我缺少一个

/>

在activity_main.xml中某一行的末尾

如果你得到这个错误签名配置。json(拒绝访问)意味着退出android studio,回到桌面主页,点击android studio图标,以管理员身份运行,这将解决问题(或者)你可以删除签名配置。Json并重新运行程序:)

在我的例子中,我启用了multidex

[project_folder] / app /构建开放。Gradle并添加以下行。

defaultConfig {
    ...

    multiDexEnabled true
}

and

dependencies {
    ...

    implementation 'com.android.support:multidex:2.0.1'
}

请尝试更新约束布局

实现“androidx.constraintlayout: constraintlayout: 2.1.3

类路径“com.android.tools.build: gradle: 3.3.2” 更改类路径就可以工作了。