Re: TaskExecutionException during mergeDebugResources

2,928 views
Skip to first unread message

Xavier Ducrohet

unread,
May 29, 2013, 12:05:25 AM5/29/13
to adt...@googlegroups.com
was there any other output? I need to check that we don't eat aapt's error output.


On Tue, May 28, 2013 at 12:24 PM, Matt Kranzler <matt.w....@gmail.com> wrote:
Hello all,

I'm attempting to switch an app with an ant build over to gradle. Unfortunately, I am unable to get passed the mergeDebugResources step as I get an exception, which isn't all too helpful. I'm using 0.4.1 and build tools version 17.

Here is the exception I get, and it seems as though it happens at random spots while crunching the drawable resources. Side note, the project consists of about 13 library projects. Any help is appreciated!

* What went wrong:
Execution failed for task ':<project>:mergeDebugResources'.
> java.lang.RuntimeException: Running /zdev/android-sdk/build-tools/17.0.0/aapt failed. See output

* Try:
Run with --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':<project>:mergeDebugResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter$1.run(CacheLockReleasingTaskExecuter.java:35)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter.execute(CacheLockReleasingTaskExecuter.java:33)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.ContextualisingTaskExecuter.execute(ContextualisingTaskExecuter.java:34)
at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter$1.run(CacheLockAcquiringTaskExecuter.java:39)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter.execute(CacheLockAcquiringTaskExecuter.java:37)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:282)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:48)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:34)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:27)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:89)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: com.android.ide.common.res2.MergeConsumer$ConsumerException: java.lang.RuntimeException: Running /zdev/android-sdk/build-tools/17.0.0/aapt failed. See output
at com.android.ide.common.res2.MergeWriter.end(MergeWriter.java:58)
at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:83)
at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:236)
at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:25)
at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.groovy:79)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.groovy:96)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
at com.android.build.gradle.tasks.MergeResources_Decorated.invokeMethod(Unknown Source)
at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:526)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:509)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 67 more
Caused by: java.lang.RuntimeException: Running /zdev/android-sdk/build-tools/17.0.0/aapt failed. See output
at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:72)
at com.android.ide.common.internal.AaptRunner.crunchPng(AaptRunner.java:52)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:124)
at com.android.ide.common.res2.MergedResourceWriter$1.call(MergedResourceWriter.java:103)

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Stephan Linzner

unread,
May 29, 2013, 5:40:10 AM5/29/13
to adt...@googlegroups.com
Have you tried to do a ./gradlew clean build 

As Gradle uses incremental builds there should be no need for invoking clean. But i'm seeing the same error from time to time. Invoking clean explicitly fixes the problem for me.

Android Developer Advocate, Google UK | slin...@google.com | +Stephan Linzner | @onlythoughtwork 

Xavier Ducrohet

unread,
May 29, 2013, 11:53:44 AM5/29/13
to adt...@googlegroups.com
Gradle is incremental in a sense that each tasks can declare its inputs/outputs and Gradle figures out if any of them changed since the last run to decide whether they should run again or not.
However when running, the tasks aren't necessarily incremental. In fact, Gradle just added some APIs to get the list of changed input to help develop truly incremental tasks (we're not using that yet, we're using a home-grown solution for a couple of tasks, and we'll switch soon to the new API).

However I think some of our other non-incremental tasks don't clean up the output of the previous run before doing their work. For instance I noticed that changing the app package in the manifest creates a new R class but doesn't delete the previous one.

I need to double check all our tasks as this can definitively lead to the need to run "gradle clean".

Matt Kranzler

unread,
May 29, 2013, 1:03:16 PM5/29/13
to adt...@googlegroups.com
I've tried to do a clean build and it still results in the same error. It seems as though it fails around the same point, only while crunching a different png. Here is the output right before it failed after doing a clean build:

Crunching single PNG file: /zdev/projects/<project-root>/<project>/build/exploded-bundles/ABS-4.2.0.aar/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-xhdpi/tab_selected_pressed_tab.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-mdpi/vpi__tab_unselected_pressed_holo.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-hdpi/abs__ab_share_pack_holo_light.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-hdpi/textfield_disabled_holo_light.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-mdpi/abs__progress_primary_holo_light.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-mdpi/abs__cab_background_bottom_holo_light.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-xhdpi/bg_widget_middle_pressed.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-xhdpi/label_shadow_3.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-hdpi/switch_thumb_pressed_holo_light.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-mdpi/abs__textfield_search_right_default_holo_dark.9.png
Crunching single PNG file: /zdev/projects/<project-root>/<project>/build/exploded-bundles/ABS-4.2.0.aar/res/drawable-mdpi/abs__cab_background_top_holo_dark.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-mdpi/abs__cab_background_top_holo_dark.9.png
Output file: /zdev/projects/<project-root>/<project>/build/res/all/debug/drawable-mdpi/abs__list_pressed_holo_dark.9.png
:<project>:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':<project>:mergeDebugResources'.
> java.lang.RuntimeException: Running /zdev/android-sdk/build-tools/17.0.0/aapt failed. See output

Matt Kranzler

unread,
May 30, 2013, 5:32:00 PM5/30/13
to adt...@googlegroups.com
So I finally got through the step and got a successful build after updating to 0.4.2. It looks like it was a malformed 9-patch image which was causing the failure, however the error wasn't being displayed so I had no idea what was causing it. With 0.4.2 it seems as though the error was finally displayed which helped in debugging it. Thanks!

Xavier Ducrohet

unread,
May 30, 2013, 5:33:33 PM5/30/13
to adt...@googlegroups.com
well that's interesting because 0.4.2 has nothing in it to fix displaying crunch error. I'll look into it.


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Xavier Ducrohet

unread,
May 30, 2013, 9:29:28 PM5/30/13
to adt...@googlegroups.com
From the error output, you are still using 0.4[.1]. This was fixed in 0.4.2, make sure you use this one.


On Thu, May 30, 2013 at 6:25 PM, Glen Wong <gl...@redrobotlabs.com> wrote:
I think I'm running into a similar issue:

Gradle: 
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':first:mergeDebugResources'.
> changedFile has no data file: /<path to base project>/android/<project name>/src/main/res/layout/frag_chat.xml
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I've noticed this happens every time I change an xml layout, so it seems like it's just one of those cases where something isn't cleaned up properly? If I try to build again after this it always works, which makes me suspect that it's doing a non-incremental build the second time around. I'm guessing that this should be taken care of as the Gradle integration matures?

Glen Wong

unread,
May 30, 2013, 9:36:16 PM5/30/13
to adt...@googlegroups.com
Awesome, updating to 0.4.2 fixes the issue. Thanks.


--
You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/-5gv55a64v0/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages