问题
I'm trying to build https://github.com/neural-nuts/Cam2Caption in Android Studio 3.1 Preview, but either I use very old build.gradle, or it dies with
Error:Execution failed for task ':Application:packageDebug'.
Execution of compression failed.
this happens after doing a project clean, or a rebuild. OSX, latest most-everything. I'm using what I think is a default latest-and-greatest 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"
With stacktrace, I get
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
回答1:
I also run into this problem lately. This happened because I included a very large zip file in the assets. I fixed this issue by adding dexoptions in app build.gradle
android {
dexOptions {
javaMaxHeapSize "4g"
}
}
And increasing JVM heap size
org.gradle.jvmargs=-Xmx4608M
like this.Go to gradle.properties
to find this option.
来源:https://stackoverflow.com/questions/47208618/execution-of-compression-failed-error-when-building-project-in-android-studio