Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why i get Some file crunching failed after i rename drawable file to .9.png?

Tags:

android

I am testing 9-patch image .
Before everything works fine , and i rename drawable file ic_button_beat_box_default.png to ic_button_beat_box_default.9.png , then i get error :

Some file crunching failed, see logs for details

. Then i rename back , it works normal. So how this happens ?

The complete error is :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details

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

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app: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)
    ...
Caused by: java.lang.RuntimeException: Some file crunching failed, see logs for details
    at com.android.builder.png.QueuedCruncher.waitForAll(QueuedCruncher.java:260)
    at com.android.builder.png.QueuedCruncher.end(QueuedCruncher.java:280)
    at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:132)
    at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:291)
    at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:48)
    at com.android.build.gradle.tasks.MergeResources.doIncrementalTaskAction(MergeResources.java:250)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:124)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 57 more
like image 428
shaoyihe Avatar asked Dec 27 '15 03:12

shaoyihe


4 Answers

On Windows I had a "BUILD FAILED Failed to crunch file [path]" error and solved it by closing the Android Studio project, copying the entire project folder into a location with a shorter directory path, such as my C: folder and then opening the project in the new location. Hope it helps

like image 75
tomalf2 Avatar answered Sep 24 '22 01:09

tomalf2


Rename your file again

ic_button_beat_box_default.9.png to ic_button_beat_box_default9.png because android studio takes ic_button_beat_box_default.9 instead of ic_button_beat_box_default.9.png

or another solution is add below line to your build.gradle(Module:app)

android{
 aaptOptions {cruncherEnabled = false} 
}
like image 40
Rahul Avatar answered Sep 27 '22 01:09

Rahul


I had the same issue by changing only file name, when I saved the image in 9-patch-tool issue solved.

like image 2
yoo Avatar answered Sep 23 '22 01:09

yoo


I had the same issue. I was able to resolve it just by reducing one folder from chain. It is due to long file path. So try using minimum hierarchy for your project location.

like image 1
Srushti Avatar answered Sep 23 '22 01:09

Srushti