我有一个运行良好的android应用程序,但仅当在调试模式下编译时才可以。当我尝试在发布模式下进行编译时,它显示了“ AAPT2错误:查看日志以获取详细信息”
这是日志错误:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeReleaseResources'.
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 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
原因:com.android.build.gradle.tasks.ResourceException:错误:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2错误:请查看日志以了解详细信息 在com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:296) 在com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106) 在sun.reflect.GeneratedMethodAccessor256.invoke(未知来源) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498) 在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) 在org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46) 在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) 在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:121) 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)处 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)处 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) ...另外32个 由以下原因引起:错误:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息 在com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:332) 在com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:301) 在com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:412) 在com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:285) ...更多47 禁止:java.lang.RuntimeException:一些文件处理失败,有关详细信息,请参见日志 在com.android.builder.internal.aapt.QueuedResourceProcessor.waitForAll(QueuedResourceProcessor.java:121) 在com.android.builder.internal.aapt.QueuedResourceProcessor.end(QueuedResourceProcessor.java:141) 在com.android.builder.internal.aapt.v2.QueueableAapt2.close(QueueableAapt2.java:104) 在com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:293) ...更多47 引起原因:java.util.concurrent.ExecutionException:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2错误:请检查日志以获取详细信息 在com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503) 在com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462) 在com.google.common.util.concurrent.AbstractFuture $ TrustedFuture.get(AbstractFuture.java:79) 在com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:327) ...另外50 引起原因:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息 在com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503) 在com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462) 在com.google.common.util.concurrent.AbstractFuture $ TrustedFuture.get(AbstractFuture.java:79) 在com.android.builder.internal.aapt.v2.QueueableAapt2.lambda $ compile $ 0(QueueableAapt2.java:136) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) ...还有1个 引起原因:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息 在com.android.builder.png.AaptProcess $ NotifierProcessOutput.handleOutput(AaptProcess.java:443) 在com.android.builder.png.AaptProcess $ NotifierProcessOutput.err(AaptProcess.java:395) 在com.android.builder.png.AaptProcess $ ProcessOutputFacade.err(AaptProcess.java:312) 在com.android.utils.GrabProcessOutput $ 1.run(GrabProcessOutput.java:104)
答案 0 :(得分:1)
AAPT2错误解决方案。
如果您的Android Studio已更新。
也许,您会在工作室中遇到“ AAPT 2错误:查看日志以获取详细信息”
当您在.xml文件中执行了错误的操作(例如,值不正确,找不到内容等)时,就会发生此错误。
但是,那时您将没有错误说明。因为新版本的Android Studio没有给您特定的错误。它给出了类似AAPT2的错误。
如果您想知道实际错误在哪里
遵循步骤。
- 查看Android Studio右侧的面板。 退出“成绩”标签,然后单击它。。
- 您将看到“应用”选项。点击它。
- 在应用程序选项中,您会看到[任务->构建]单击它。
- 然后您将获得选项列表,并双击“ assembleDebug”
- 保持耐心并查看Android底部面板上的“构建”选项卡 工作室,您会在此看到特定的错误。