Gaurang Patel
Gaurang Patel

Reputation: 4530

Ionic: Execution failed for task ':mergeDebugResources' (Some file crunching failed)

Ionic build command was working fine until I decided to add some custom splash screen and run the following command,

ionic resources

Post that every time I run build command, I got below error while running build command,

:mergeDebugResourcesAAPT err(Facade for 35126910): libpng error: Read Error FAILED

FAILURE: Build failed with an exception.

What went wrong:

Execution failed for task ':mergeDebugResources'.

Some file crunching failed, see logs for details

Try:

BUILD FAILED

So clearly, ionic resources command created some issues.

Please help!

Upvotes: 5

Views: 11617

Answers (9)

Satish Varre
Satish Varre

Reputation: 131

Please change path of your project folder; previous path is too long. Example:

d:projects/tfs/demos/ionic/projects/project_Name to projects/project_name folder

or

by using subst command in command prompt like below

 d:projects/tfs/demos/ionic/projects/project_Name folder :subst i: .

It will make an "i drive" in PC; open your project with that and build it.

Upvotes: 0

Jose Marval
Jose Marval

Reputation: 1

Delete the Android platform and give full permission to the public to the platform folder.

Upvotes: 0

Om Shankar
Om Shankar

Reputation: 283

Make you path small For example test/project/source/… change it to t/p/source… It will work

Upvotes: 0

spaceman
spaceman

Reputation: 649

Had the same issue. Fixed by removing the whitespaces at my project's name folder.

Before:

/ionic project/myApp

After:

/ionicproject/myApp

Upvotes: 0

Ronald Padur
Ronald Padur

Reputation: 359

In my case it was the too long directory path. After I copied everything directly to d:\myapp, the "ionic cordova build android" command works as expected.

I found the solution in the ionic forum:

Ionic Forum - Build Failed on existing project

Upvotes: 2

sp1111
sp1111

Reputation: 798

For me it's because the path name is too long in Windows. Renaming some folders to shorter names solved the issue.

Upvotes: 2

Taki Rahal
Taki Rahal

Reputation: 11

Delete folder platform Delete folder android and ios in folder "resources" execute : ionic platform add android after execute : ionic resources and finaly execute : ionic build android

Upvotes: 0

eildiz
eildiz

Reputation: 537

try to delete platforms\android\build\intermediates\incremental\mergeDebugResources\merged.dir\values-km

Its work for me!

Upvotes: 0

Gaurang Patel
Gaurang Patel

Reputation: 4530

After going through multiple online resources, I found that ionic resources processes/optimizes the resultant PNG files. Post that, when you run ionic build android command, Android build itself tries to work on already processed/optimized Splash screens but it doesn't work well and it reports an error.

So, the fix is to tell Android Build not to touch those PNG files at all and go ahead with what it is given. How to do that?

Put cruncherEnabled = false in platforms\android\build.gradle file as below,

android {

aaptOptions {
cruncherEnabled = false
}

...

Re-run the build and it goes through without any problem! :)

Upvotes: 15

Related Questions