web-dev-qa-db-ja.com

Android Studio 3.1でプロジェクトをビルドすると、「圧縮の実行に失敗しました」エラー

私はビルドしようとしています https://github.com/neural-nuts/Cam2Caption in Android Studio 3.1 Previewですが、非常に古いbuild.gradleを使用しています、またはそれが

Error:Execution failed for task ':Application:packageDebug'.
Execution of compression failed.

これは、プロジェクトのクリーンアップまたは再構築後に発生します。 OSX、最新のほとんどすべて。私は私が使用しているものを使用していますthinkはデフォルトの最新かつ最も優れたbuild.gradleです

classpath 'com.Android.tools.build:gradle:3.0.0'
...
Android {
    compileSdkVersion 26
    defaultConfig {
        minSdkVersion 26
        targetSdkVersion 26
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
....
        compile "com.Android.support:support-v4:26.1.0"
        compile "com.Android.support:support-v13:26.1.0"
        compile "com.Android.support:cardview-v7:26.1.0"
        compile "com.Android.support:appcompat-v7:26.1.0"

スタックトレースを使用すると、

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Application:packageDebug'.
> Java.io.IOException: Execution of compression failed.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':Application:packageDebug'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.Java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.Java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.Java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.Java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.Java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.Java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.Java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.Java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.Java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.Java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.Java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.Java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.Java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.Java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.Java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.Java:55)
Caused by: org.gradle.tooling.BuildException: Java.io.IOException: Execution of compression failed.
    at com.Android.build.gradle.internal.scope.OutputScope.lambda$parallelForEachOutput$10(OutputScope.Java:241)
    at com.Android.build.gradle.internal.scope.OutputScope.parallelForEachOutput(OutputScope.Java:236)
    at com.Android.build.gradle.internal.scope.OutputScope.parallelForEachOutput(OutputScope.Java:197)
    at com.Android.build.gradle.internal.scope.OutputScope.parallelForEachOutput(OutputScope.Java:181)
    at com.Android.build.gradle.tasks.PackageAndroidArtifact.doFullTaskAction(PackageAndroidArtifact.Java:449)
    at com.Android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.Java:109)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.Java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.Java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.Java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.Java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.Java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:92)
    ... 29 more
Caused by: Java.lang.RuntimeException: Java.io.IOException: Execution of compression failed.
Caused by: Java.io.IOException: Execution of compression failed.
    at com.Android.apkzlib.Zip.CentralDirectoryHeader.getCompressionInfoWithWait(CentralDirectoryHeader.Java:431)
    at com.Android.apkzlib.Zip.ZFile.processAllReadyEntriesWithWait(ZFile.Java:1749)
    at com.Android.apkzlib.Zip.ZFile.hasPendingChangesWithWait(ZFile.Java:2623)
    at com.Android.apkzlib.zfile.ApkZFileCreator.hasPendingChangesWithWait(ApkZFileCreator.Java:180)
    at com.Android.builder.internal.packaging.IncrementalPackager.hasPendingChangesWithWait(IncrementalPackager.Java:319)
    at com.Android.build.gradle.tasks.PackageAndroidArtifact.doTask(PackageAndroidArtifact.Java:672)
    at com.Android.build.gradle.tasks.PackageAndroidArtifact.splitFullAction(PackageAndroidArtifact.Java:500)
    at com.Android.build.gradle.internal.scope.OutputScope.lambda$parallelForEachOutput$6(OutputScope.Java:186)
    at com.Android.build.gradle.internal.scope.OutputScope.lambda$parallelForEachOutput$7(OutputScope.Java:203)
    at com.Android.build.gradle.internal.scope.OutputScope.lambda$null$8(OutputScope.Java:225)
    Suppressed: Java.io.IOException: Failed to obtain compression information for entry
        at com.Android.apkzlib.Zip.ZFile.processAllReadyEntries(ZFile.Java:1727)
        at com.Android.apkzlib.Zip.ZFile.processAllReadyEntriesWithWait(ZFile.Java:1741)
        at com.Android.apkzlib.Zip.ZFile.update(ZFile.Java:904)
        at com.Android.apkzlib.Zip.ZFile.close(ZFile.Java:1196)
        at com.Android.apkzlib.zfile.ApkZFileCreator.close(ApkZFileCreator.Java:189)
        at com.google.common.io.Closer.close(Closer.Java:216)
        at com.Android.builder.internal.packaging.IncrementalPackager.close(IncrementalPackager.Java:332)
        at com.Android.build.gradle.tasks.PackageAndroidArtifact.doTask(PackageAndroidArtifact.Java:678)
        at com.Android.build.gradle.tasks.PackageAndroidArtifact.splitFullAction(PackageAndroidArtifact.Java:500)
        at com.Android.build.gradle.internal.scope.OutputScope.lambda$parallelForEachOutput$6(OutputScope.Java:186)
        at com.Android.build.gradle.internal.scope.OutputScope.lambda$parallelForEachOutput$7(OutputScope.Java:203)
        at com.Android.build.gradle.internal.scope.OutputScope.lambda$null$8(OutputScope.Java:225)
        at Java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.Java:1424)
        at Java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.Java:289)
        at Java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.Java:1056)
        at Java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.Java:1692)
        at Java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.Java:157)
    Caused by: Java.util.concurrent.ExecutionException: Java.lang.IllegalArgumentException: Self-suppression not permitted
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.Java:503)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.Java:462)
        at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.Java:79)
        at com.Android.apkzlib.Zip.ZFile.processAllReadyEntries(ZFile.Java:1722)
        ... 16 more
    Caused by: Java.lang.IllegalArgumentException: Self-suppression not permitted
        at com.Android.apkzlib.Zip.compress.DeflateExecutionCompressor.immediateCompress(DeflateExecutionCompressor.Java:72)
        at com.Android.apkzlib.Zip.compress.ExecutorCompressor.lambda$compress$0(ExecutorCompressor.Java:54)
    Caused by: Java.lang.OutOfMemoryError: Java heap space
Caused by: Java.util.concurrent.ExecutionException: Java.lang.IllegalArgumentException: Self-suppression not permitted
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.Java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.Java:482)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.Java:79)
    at com.Android.apkzlib.Zip.CentralDirectoryHeader.getCompressionInfoWithWait(CentralDirectoryHeader.Java:425)
    ... 9 more
    [CIRCULAR REFERENCE:Java.lang.IllegalArgumentException: Self-suppression not permitted]

* Get more help at https://help.gradle.org 
BUILD FAILED in 12s
15
Benjamin H

最近この問題にも遭遇しました。これは、非常に大きなZipファイルをアセットに含めたために発生しました。アプリbuild.gradleにdexoptionsを追加して、この問題を修正しました

Android {
    dexOptions {
        javaMaxHeapSize "4g"
    } 
}

そして、JVMヒープサイズを増やす

org.gradle.jvmargs=-Xmx4608M

このオプションを見つけるには、gradle.propertiesにアクセスしてください。

40
sunil sunny